swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit 643e1d694c158cb7bd4c374836afbecef2799363
parent 3d6534495efbbfab0784384d523d70b62ab269f7
Author: Michael Forney <mforney@mforney.org>
Date:   Fri, 22 Nov 2013 17:38:44 -0800

Makefile: Allow overriding of per-package CFLAGS/LIBS

Diffstat:
MMakefile | 9++++++---
MMakefile.common | 4++--
2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile @@ -12,7 +12,6 @@ SUBDIRS := launch libswc protocol CLEAN_FILES := $(TARGETS) include config.mk -include $(SUBDIRS:%=%/Makefile.local) ifeq ($(if $(V),$(V),0), 0) define quiet @@ -28,8 +27,12 @@ define check_deps @$(PKG_CONFIG) --exists --print-errors $2 endef -compile = $(call quiet,CC) $(CFLAGS) $(CPPFLAGS) -I . -c -MMD -MP -MF .deps/$(basename $<).d -o $@ $< -link = $(call quiet,CCLD,$(CC)) $(CFLAGS) -o $@ $^ +compile = $(call quiet,CC) $(CFLAGS) $(CPPFLAGS) -I . -c -MMD -MP -MF .deps/$(basename $<).d -o $@ $< +link = $(call quiet,CCLD,$(CC)) $(CFLAGS) -o $@ $^ +pkgconfig = $(sort $(foreach pkg,$(1),$(if $($(pkg)_$(3)),$($(pkg)_$(3)), \ + $(shell $(PKG_CONFIG) --$(2) $(pkg))))) + +include $(SUBDIRS:%=%/Makefile.local) $(foreach dir,BIN LIB INCLUDE PKGCONFIG,$(DESTDIR)$($(dir)DIR)): mkdir -p "$@" diff --git a/Makefile.common b/Makefile.common @@ -20,10 +20,10 @@ $(dir)/%.lo: $(dir)/%.c | .deps/$(dir) ifdef $(dir)_PACKAGES ifndef $(dir)_PACKAGE_CFLAGS - $(dir)_PACKAGE_CFLAGS := $(shell $(PKG_CONFIG) --cflags $($(dir)_PACKAGES)) + $(dir)_PACKAGE_CFLAGS := $(call pkgconfig,$($(dir)_PACKAGES),cflags,CFLAGS) endif ifndef $(dir)_PACKAGE_LIBS - $(dir)_PACKAGE_LIBS := $(shell $(PKG_CONFIG) --libs $($(dir)_PACKAGES)) + $(dir)_PACKAGE_LIBS := $(call pkgconfig,$($(dir)_PACKAGES),libs,LIBS) endif endif