diff --git a/Makefile b/Makefile index d2a15d6..ae62fba 100755 --- a/Makefile +++ b/Makefile @@ -2,8 +2,7 @@ #******************************************************************************# # Include variables and message subsystem # #******************************************************************************# -include Makefile.vars -include Makefile.msg +include Makefile.vars Makefile.msg #******************************************************************************# # General targets # @@ -146,21 +145,23 @@ $(eval $(call make-moduleobj-rule,$(mod)))) .PHONY: all-lib mostlyclean-lib mclean-lib clean-lib re-lib .PHONY: install-lib uninstall-lib #******************************************************************************# -# Configuration tool-related # +# Configuration tools-related # #******************************************************************************# # Install it. install-cfgtool: $(CHECKCFG) $(call imsg,Installing the configuration tool.) $(call qcmd,$(INST) -m 755 -d "$(IBINDIR)") - $(call qcmd,tools/write-config --name=lib$(NAME) --version=$(VERSION) \ + $(call qcmd,tools/write-config \ + --name=lib$(NAME) --version=$(VERSION) \ --author-name="$(AUTHOR)" --author-mail="$(AUTHOR_MAIL)" \ - --incdir="$(IINCDIR)" --libdir="$(IBINDIR)" \ + --incdir="$(OIINCDIR)" --libdir="$(OILIBDIR)" \ >"$(IBINDIR)/lib$(NAME)-config" \ && chmod 755 "$(IBINDIR)/lib$(NAME)-config") $(call imsg,Installing the pkg-config configuration.) $(call qcmd,$(INST) -m 755 -d "$(IPKGDIR)") - $(call qcmd,tools/write-pkg-config --name=$(NAME) --version=$(VERSION) \ + $(call qcmd,tools/write-pkg-config \ + --name=$(NAME) --version=$(VERSION) \ --description="$(DESCRIPTION)" \ --incdir="$(OIINCDIR)" --libdir="$(OILIBDIR)" \ >"$(IPKGDIR)/lib$(NAME).pc" \ @@ -168,7 +169,7 @@ $(eval $(call make-moduleobj-rule,$(mod)))) # Uninstall it uninstall-cfgtool: $(CHECKCFG) - $(call rmsg,Uninstalling configuration tool.) + $(call rmsg,Uninstalling configuration tool and package.) $(call qcmd,$(RM) "$(IBINDIR)/lib$(NAME)-config" "$(IPKGDIR)/lib$(NAME).pc") .PHONY: install-cfgtool uninstall-cfgtool diff --git a/Makefile.vars b/Makefile.vars index 8e39f54..9e4c41d 100755 --- a/Makefile.vars +++ b/Makefile.vars @@ -59,6 +59,9 @@ #******************************************************************************# # Binary utilities # #******************************************************************************# +# Package configuration + PKGCONFIG := $(TARGET)pkg-config + # Compiler CC := $(TARGET)gcc # - Check flags (warnings) @@ -70,6 +73,7 @@ -D LOGLEVEL="ll_$(LOG_LEVEL)" \ -D AUTHOR="$(AUTHOR)" -D AUTHOR_MAIL="$(AUTHOR_MAIL)" \ -D LICENSE="$(LICENSE)" -D VERSION="$(VERSION)" \ + $(shell $(PKGCONFIG) --cflags zlib 2>/dev/null ) \ $(CMOREFLAGS) # Linker @@ -80,7 +84,8 @@ -e __lib$(NAME)_version \ -Wl,-z,relro -Wl,-z,combreloc -Wl,-z,defs # - Linker flags - LDFLAGS := -shared -lz \ + LDFLAGS := -shared \ + $(shell $(PKGCONFIG) --libs zlib 2>/dev/null ) \ $(if $(FOR_WINDOWS),$(LDFLAGS_Windows),$(LDFLAGS_Linux)) # Directory maker diff --git a/configure b/configure index 7f40246..8daaba0 100755 --- a/configure +++ b/configure @@ -15,7 +15,7 @@ author="$author_name <$(make -s getmail)>" target="" # Platform -platform="$(gcc --print-multiarch)" +platform="$(command -v gcc 1>/dev/null && gcc --print-multiarch)" platform="$([ "$platform" ] && echo "/$platform")" # Make options