antimake: stop converting filenames in flag variables
authorMarko Kreen <markokr@gmail.com>
Sun, 4 Mar 2012 09:07:14 +0000 (11:07 +0200)
committerMarko Kreen <markokr@gmail.com>
Sun, 4 Mar 2012 21:03:18 +0000 (23:03 +0200)
The variables tgt_LDFLAGS / tgt_CPPFLAGS / tgt_CFLAGS
may contain complex flags, where some words
look like filenames.  Convering those breaks build.

Keep converting only variables that definitely contain
filenames: _SOURCES / _LIBADD / _LDADD.

mk/antimake.mk
mk/antimake.txt

index 7a76f0f167bde9ff22dfe53040310a34229186a7..9fde63c92652dec8b4d0b982a06e028375cf3d71 100755 (executable)
@@ -691,7 +691,7 @@ UsualSources = $(call UsualSrcsFull,$(call UsualMods,$(1)))
 
 ## add subdir to files
 # 1-subdir, 2-file list
-RelocFiles = $(foreach f,$(2),$(call JoinPath,$(1),$(f)))
+RelocFiles = $(foreach f,$(2),$(if $(filter -%,$(f)),$(f),$(call JoinPath,$(1),$(f))))
 
 
 # 1-dir, 2-pfx, 3-full
@@ -702,14 +702,13 @@ RelocOneFlag = $(if $(filter -L%,$(2)), \
                     $(call RelocOneFlag2,$(1),-L,$(2)), \
                    $(if $(filter -I%,$(2)), \
                          $(call RelocOneFlag2,$(1),-I,$(2)), \
-                        $(if $(filter -%,$(2)), \
-                             $(2), \
-                             $(call JoinPath,$(1),$(2)))))
+                        $(2)))
 
 ## Relocate relative files, relative -I/-L, ignore -*
 # 1-dir, 2- flaglist
 RelocFlags = $(strip $(if $(filter-out .,$(1)), \
-                          $(foreach flg,$(2),$(call RelocOneFlag,$(1),$(flg))),$(2)))
+                          $(foreach flg,$(2),$(call RelocOneFlag,$(1),$(flg))), \
+                         $(2)))
 
 
 ## Separate build dir relocation
@@ -761,8 +760,8 @@ $(foreach var,$(AM_TARGET_VARIABLES),$(NewLine)$$(am_PFX)_$(1)_$(var) := $$($(1)
 
 # move and relocate
 $$(am_PFX)_$(1)_SOURCES := $$(call RelocFiles,$$(am_DIR),$$($(1)_SOURCES))
-$$(am_PFX)_$(1)_LDADD := $$(call RelocFlags,$$(am_DIR),$$($(1)_LDADD))
-$$(am_PFX)_$(1)_LIBADD := $$(call RelocFlags,$$(am_DIR),$$($(1)_LIBADD))
+$$(am_PFX)_$(1)_LDADD := $$(call RelocFiles,$$(am_DIR),$$($(1)_LDADD))
+$$(am_PFX)_$(1)_LIBADD := $$(call RelocFiles,$$(am_DIR),$$($(1)_LIBADD))
 $$(am_PFX)_$(1)_CFLAGS := $$(call RelocFlags,$$(am_DIR),$$($(1)_CFLAGS))
 $$(am_PFX)_$(1)_CPPFLAGS := $$(call RelocFlags,$$(am_DIR),$$($(1)_CPPFLAGS))
 $$(am_PFX)_$(1)_LDFLAGS := $$(call RelocFlags,$$(am_DIR),$$($(1)_LDFLAGS))
index d161975eee4f528fb79191232d972bb7d64584aa..e628fb54a7cf05fcb403ff26fe759d505c8cdd71 100644 (file)
@@ -248,6 +248,21 @@ src_hello_SOURCES = src/main.c
 src_hello_CPPFLAGS = -I./src/include
 ----------------------
 
+Variables, where file names are converted:
+
+* SUBDIRS, DIST_SUBDIRS, EMBED_SUBDIRS
+* DISTFILES, CLEANFILES, DISTCLEANFILES, MAINTAINERCLEANFILES
+* target lists
+* <tgt>_SOURCES, <tgt>_LDADD, <tgt>_LIBADD
+
+Variables, where -L and -I flags are converted:
+
+* <tgt>_CFLAGS
+* <tgt>_CPPFLAGS
+* <tgt>_LDFLAGS
+
+Makefile should be written in a way that those conversions
+would be enough.
 
 === Global variables for current location ===