Jelajahi Sumber

makefile: store the flavour in tarball

- Makefile.vars is auto-generated to store the flavour when creating the
  tarball
- Makefile.vars is stored inside the tarball
- do 'make maintainer-clean' or 'make clean-makefile-vars' to remove it
- allow to build the packaged flavour even when 'make FLAVOUR=... cfg'
  is forgotten - suggested by Olle E. Johansson
Daniel-Constantin Mierla 14 tahun lalu
induk
melakukan
dd15ae96c0
2 mengubah file dengan 11 tambahan dan 2 penghapusan
  1. 9 2
      Makefile
  2. 2 0
      Makefile.defs

+ 9 - 2
Makefile

@@ -772,12 +772,16 @@ utils:
 dbg: sip-router
 	gdb -command debug.gdb
 
+.PHONY: makefile_vars makefile-vars
+makefile_vars makefile-vars:
+	echo "FLAVOUR?=$(FLAVOUR)" > Makefile.vars
+
 .PHONY: tar
 .PHONY: dist
 
 dist: tar
 
-tar: $(auto_gen_keep)
+tar: makefile_vars $(auto_gen_keep)
 	$(TAR) -C .. \
 		--exclude=$(notdir $(CURDIR))/test* \
 		--exclude=$(notdir $(CURDIR))/tmp* \
@@ -1143,7 +1147,7 @@ maintainer-clean: modules=$(modules_all)
 proper realclean distclean maintainer-clean: clean_cfg
 
 # on maintainer clean, remove also the configured module list
-maintainer-clean: clean_modules_cfg
+maintainer-clean: clean_modules_cfg clean_makefile_vars
 
 .PHONY: proper-all realclean-all distclean-all
 proper-all realclean-all distclean-all: cmodules=$(all_modules_lst)
@@ -1158,6 +1162,9 @@ clean_cfg clean-cfg:
 clean_modules_cfg clean-modules-cfg:
 	rm -f modules.lst
 
+.PHONY: clean_makefile_vars clean-makefile-vars
+	rm -f Makefile.vars
+
 .PHONY: dbschema
 dbschema:
 	-@echo "Build database schemas"

+ 2 - 0
Makefile.defs

@@ -117,6 +117,8 @@ ifeq ($(quiet),verbose)
 $(info normal Makefile.defs exec)
 endif # verbose
 
+-include Makefile.vars
+
 # usage: $(call set_if_empty,VAR,value)
 set_if_empty=$(if $($(1)),,$(eval override $(1)=$(2)))