SAY = @echo '$(strip $(1))'
endif
+PACKAGE := micoforia
+DEFINES = \
+ $(call DEFINE,PACKAGE,$(PACKAGE)) \
+ $(call DEFINE,AUTHOR,Andre Noll) \
+ $(call DEFINE,COPYRIGHT_YEAR,2019) \
+ $(call DEFINE,SLOGAN,Minimal Containers for Instant Access) \
+ $(call DEFINE,EMAIL,maan@tuebingen.mpg.de) \
+ $(call DEFINE,URL,http://people.tuebingen.mpg.de/maan/$(PACKAGE)/) \
+ $(call DEFINE,CLONE_URL,git://git.tuebingen.mpg.de/$(PACKAGE)) \
+ $(call DEFINE,GITWEB_URL,http://git.tuebingen.mpg.de/$(PACKAGE).git) \
+ $(call DEFINE,HOME_URL,http://people.tuebingen.mpg.de/maan/) \
+ $(call DEFINE,LICENSE,GNU GPL version 3) \
+ $(call DEFINE,LICENSE_URL,https://www.gnu.org/licenses/gpl-3.0-standalone.html)
+DEFINE = -D$(1)='"$(2)"'
+# LOGLEVELS is special because it is defined unquoted
+LOGLEVELS := LL_DEBUG,LL_INFO,LL_NOTICE,LL_WARNING,LL_ERROR,LL_CRIT,LL_EMERG
+CPP_DEFINES := $(DEFINES) -DLOGLEVELS='$(LOGLEVELS)'
+DEFINE = -D "$(1)=$(2)"
+M4_DEFINES := $(DEFINES)
+
.ONESHELL:
.SHELLFLAGS := -ec
PREFIX ?= /usr/local
all := micoforia micoforia.8
all: $(all)
-PACKAGE := micoforia
-SLOGAN := Minimal Containers for Instant Access
-AUTHOR := Andre Noll
-EMAIL := maan@tuebingen.mpg.de
-COPYRIGHT_YEAR := 2019
-URL := http://people.tuebingen.mpg.de/maan/$(PACKAGE)/
-CLONE_URL := git://git.tuebingen.mpg.de/$(PACKAGE)
-GITWEB_URL := http://git.tuebingen.mpg.de/$(PACKAGE).git
-HOME_URL := http://people.tuebingen.mpg.de/maan/
-LICENSE := GNU GPL version 3
-LICENSE_URL := https://www.gnu.org/licenses/gpl-3.0-standalone.html
-LOGLEVELS := LL_DEBUG,LL_INFO,LL_NOTICE,LL_WARNING,LL_ERROR,LL_CRIT,LL_EMERG
-
units := micoforia util version micoforia.lsg
deps := $(addprefix $(B)/, $(addsuffix .d, $(units)))
objs := $(addprefix $(B)/, $(addsuffix .o, $(units)))
-include $(B)/config.mak
endif
-M4 += \
- -D "AUTHOR=$(AUTHOR)" \
- -D "COPYRIGHT_YEAR=$(COPYRIGHT_YEAR)" \
- -D "PACKAGE=$(PACKAGE)" \
- -D "SLOGAN=$(SLOGAN)" \
- -D "EMAIL=$(EMAIL)" \
- -D "URL=$(URL)" \
- -D "CLONE_URL=$(CLONE_URL)" \
- -D "GITWEB_URL=$(GITWEB_URL)" \
- -D "HOME_URL=$(HOME_URL)" \
- -D "LICENSE=$(LICENSE)" \
- -D "LICENSE_URL=$(LICENSE_URL)" \
- defs.m4
-
-XCPPFLAGS :=
-XCPPFLAGS += -I$(B)
-XCPPFLAGS += -Wunused-macros
-XCPPFLAGS += -DCOPYRIGHT_YEAR='"$(COPYRIGHT_YEAR)"'
-XCPPFLAGS += -DPACKAGE='"$(PACKAGE)"'
-XCPPFLAGS += -DAUTHOR='"$(AUTHOR)"'
-XCPPFLAGS += -DEMAIL='"$(EMAIL)"'
-XCPPFLAGS += -DURL='"$(URL)"'
-XCPPFLAGS += -DCLONE_URL='"$(CLONE_URL)"'
-XCPPFLAGS += -DGITWEB_URL='"$(GITWEB_URL)"'
-XCPPFLAGS += -DHOME_URL='"$(HOME_URL)"'
-XCPPFLAGS += -DLOGLEVELS='$(LOGLEVELS)'
-XCPPFLAGS += -DLICENSE='"$(LICENSE)"'
-XCPPFLAGS += -DLICENSE_URL='"$(LICENSE_URL)"'
+M4 += $(M4_DEFINES) defs.m4
+
+XCPPFLAGS := $(CPP_DEFINES) -I$(B) -Wunused-macros
XCFLAGS :=
XCFLAGS += -fno-strict-aliasing