Blame | Last modification | View Log | Download
#The Major Version NumberVERSION_MAJ ?= 1#The Minor Version NumberVERSION_MIN ?= 6#the build type we are making (release or debug)BUILD ?= release#the prefix to install the library intoPREFIX ?= /usr/local# dont build HID support by defaultUSE_HID ?= 0# use builtin tinyXML by defaultUSE_BI_TXML ?= 1#the System we are building onUNAME := $(shell uname -s)# The version of macOS we might be building onDARWIN_VERSION = 0# A simple flag to help determine if we're building on 10.14 or greater# 0 = false, 1 = trueDARWIN_MOJAVE_UP = 0ifeq ($(UNAME),Darwin)# Returns a macOS version number as `10.14`DARWIN_VERSION := $(shell sw_vers -productVersion)DARWIN_MOJAVE_UP := $(shell expr $(DARWIN_VERSION) \>= 10.14)endif#the location of Doxygen to generate our api documentationDOXYGEN := $(shell which doxygen)#dot is required for doxygen (part of Graphviz)DOT := $(shell which dot)#the machine type we are building on (i686 or x86_64)MACHINE := $(shell uname -m)#the location of xmllink for checking our config filesXMLLINT := $(shell which xmllint)#temp directory to build our tarfile for make dist targetTMP := /tmp#pkg-config binary for package config filesPKGCONFIG := $(shell which pkg-config)#git binary for doing a make dist exportGIT := $(shell which git)#check if this is a Git Checkout, or a Distribution FileGITDIR := $(wildcard $(top_srcdir)/.git/)ifneq ($(GITDIR),)ifneq ($(GIT),0)GITCO := 1elseGITCO := 0endifelseGITCO := 0endififeq ($(GITCO), 1)_ := $(shell $(GIT) -C $(top_srcdir) update-index --assume-unchanged dist/openzwave.spec 2>&1)ifneq ($(_),)$(warning git update-index returned: $(_))endifGITVERSION := $(shell $(GIT) -C $(top_srcdir) describe --long --tags --dirty 2>/dev/null | sed s/^v//)_ := $(shell $(GIT) -C $(top_srcdir) update-index --no-assume-unchanged dist/openzwave.spec 2>&1)ifneq ($(_),)$(warning git update-index returned: $(_))endififeq ($(GITVERSION),)$(warning git describe returned an empty result, setting GITVERSION to VERSION_MAJ.VERSION_MIN.-1 and VERSION_REV to 0)GITVERSION := $(VERSION_MAJ).$(VERSION_MIN).-1VERSION_REV := 0elseVERSION_REV ?= $(shell echo $(GITVERSION) | awk '{split($$0,a,"-"); print a[2]}')endifelseifeq ($(VERSION_REV),)VERFILE := $(wildcard $(top_srcdir)/cpp/src/vers.cpp)ifneq ($(VERFILE),)VERSION_REV := $(shell sed -n 's/uint16_t ozw_vers_revision = \(.*\);$$/\1/p' $(VERFILE))else$(warning Missing Either Git Binary, Not a Source Checkout or doesn't have a vers.cpp)endifendifendififeq ($(VERSION_REV),)VERSION_REV ?= 0endif# version number to use on the shared libraryVERSION := $(VERSION_MAJ).$(VERSION_MIN)# using seting from bitbakeifeq ($(BITBAKE_ENV),1)CC := $(CC)CXX := $(CXX)LD := $(CXX)AR := $(AR)RANLIB := $(RANLIB)else# support Cross Compiling optionsifeq ($(UNAME),FreeBSD)# Actually hide behind c++ which works for both clang based 10.0 and earlier(?)CC := $(CROSS_COMPILE)ccCXX := $(CROSS_COMPILE)c++LD := $(CROSS_COMPILE)c++elseCC := $(CROSS_COMPILE)gccCXX := $(CROSS_COMPILE)g++LD := $(CROSS_COMPILE)g++endififeq ($(UNAME),Darwin)AR := libtool -static -oRANLIB := ranlibCC := clangCXX := clang++LD := clang++elseAR := $(CROSS_COMPILE)ar rcRANLIB := $(CROSS_COMPILE)ranlibendifendifSED := sed#determine if we are release or debug Build and set appropriate flagsifeq ($(BUILD), release)CFLAGS += -c $(RELEASE_CFLAGS)CPPFLAGS += $(RELEASE_CPPFLAGS)LDFLAGS += $(RELEASE_LDFLAGS)elseCFLAGS += -c $(DEBUG_CFLAGS)CPPFLAGS += $(DEBUG_CPPFLAGS)LDFLAGS += $(DEBUG_LDFLAGS)endif#if /lib64 exists, then setup x86_64 library path to lib64 (good indication if a linux has /lib and lib64).#Else, if it doesnt, then set as /lib. This is used in the make install targetifeq ($(wildcard /lib64),)instlibdir.x86_64 = /lib/elseinstlibdir.x86_64 = /lib64/endifinstlibdir.default = /lib/#our actual install location for the libraryifneq ($(instlibdir.$(MACHINE)),)instlibdir ?= $(PREFIX)$(instlibdir.$(MACHINE))elseinstlibdir ?= $(PREFIX)$(instlibdir.default)endif#pkg-config doesn't exist, lets try to guess best place to put the pc fileifeq ($(PKGCONFIG),)pkgconfigdir ?= $(shell if [ -d "/usr/lib64/pkgconfig" ]; then echo "/usr/lib64/pkgconfig"; else echo "/usr/lib/pkgconfig"; fi)elsepkgconfigdir ?= $(shell test -d "$(instlibdir)/pkgconfig" && echo "$(instlibdir)/pkgconfig" || pkg-config --variable pc_path pkg-config | awk -F: '{ print $$1 }')endififeq ($(BITBAKE_ENV),1)sysconfdir := $(PREFIX)/etc/openzwave/includedir := $(PREFIX)/include/openzwave/docdir := $(PREFIX)/share/doc/openzwave-$(VERSION).$(VERSION_REV)elsesysconfdir ?= $(PREFIX)/etc/openzwave/includedir ?= $(PREFIX)/include/openzwave/docdir ?= $(PREFIX)/share/doc/openzwave-$(VERSION).$(VERSION_REV)endiftop_builddir ?= $(CURDIR)export top_builddirOBJDIR = $(top_builddir)/.libDEPDIR = $(top_builddir)/.depifeq ($(UNAME),NetBSD)FMTCMD = fmt -g 1elseFMTCMD = fmt -1endif$(OBJDIR)/%.o : %.cpp@echo "Building $(<:$(top_builddir)/cpp/%=%)"@$(CXX) -MM $(CFLAGS) $(CPPFLAGS) $(INCLUDES) $< > $(DEPDIR)/$*.d@mv -f $(DEPDIR)/$*.d $(DEPDIR)/$*.d.tmp@$(SED) -e 's|.*:|$(OBJDIR)/$*.o: $(DEPDIR)/$*.d|' < $(DEPDIR)/$*.d.tmp > $(DEPDIR)/$*.d;@$(SED) -e 's/.*://' -e 's/\\$$//' < $(DEPDIR)/$*.d.tmp | $(FMTCMD) | \$(SED) -e 's/^ *//' -e 's/$$/:/' >> $(DEPDIR)/.$*.d;@rm -f $(DEPDIR)/$*.d.tmp@$(CXX) $(CFLAGS) $(CPPFLAGS) $(TARCH) $(INCLUDES) -o $@ $<$(OBJDIR)/%.o : %.c@echo "Building $(<:$(top_builddir)/cpp/src/%=%)"@$(CC) -MM $(CFLAGS) $(INCLUDES) $< > $(DEPDIR)/$*.d@mv -f $(DEPDIR)/$*.d $(DEPDIR)/$*.d.tmp@$(SED) -e 's|.*:|$(OBJDIR)/$*.o: $(DEPDIR)/$*.d|' < $(DEPDIR)/$*.d.tmp > $(DEPDIR)/$*.d;@$(SED) -e 's/.*://' -e 's/\\$$//' < $(DEPDIR)/$*.d.tmp | $(FMTCMD) | \$(SED) -e 's/^ *//' -e 's/$$/:/' >> $(DEPDIR)/.$*.d;@rm -f $(DEPDIR)/$*.d.tmp@$(CC) $(CFLAGS) $(TARCH) $(INCLUDES) -o $@ $<dummy := $(shell test -d $(OBJDIR) || mkdir -p $(OBJDIR))dummy := $(shell test -d $(DEPDIR) || mkdir -p $(DEPDIR))