kbuild: Add $(obj), $(src) for generated files
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Tue, 18 Jun 2002 16:52:40 +0000 (11:52 -0500)
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Tue, 18 Jun 2002 16:52:40 +0000 (11:52 -0500)
I suppose one can argue whether that is ugly or rather nice for
documentary purposes, but make on its own cannot figure out where a file
is supposed to live, so we have to help it.

(For the targets handled by Rules.make the situation is different, there
 Rules.make knows what's source and what's object and can add prefixes
 as necessary, so the most of the Makefiles are actually not affected by
 this kind of change)

For now, as $(obj) = $(src) = ., we only add "./", so the potential for
breakage is rather small.

drivers/acorn/char/Makefile
drivers/atm/Makefile
drivers/sbus/char/Makefile
drivers/scsi/Makefile
drivers/scsi/aic7xxx/Makefile
drivers/tc/Makefile
net/802/Makefile
net/khttpd/Makefile
sound/oss/Makefile

index f5ad3bc..fc00f79 100644 (file)
@@ -20,5 +20,5 @@ obj-y         += $(obj-$(MACHINE))
 
 include $(TOPDIR)/Rules.make
 
-%.c: %.map
+$(obj)/%.c: $(src)/%.map
        loadkeys --mktable $< > $@
index 6d3e2cb..274bfa0 100644 (file)
@@ -52,52 +52,26 @@ endif
 
 obj-$(CONFIG_ATM_FORE200E) += fore_200e.o
 
-EXTRA_CFLAGS=-g
-
 fore_200e-objs := fore200e.o $(FORE200E_FW_OBJS)
 
 host-progs := fore200e_mkfirm
 
-include $(TOPDIR)/Rules.make
+EXTRA_CFLAGS := -g
 
+include $(TOPDIR)/Rules.make
 
 # FORE Systems 200E-series firmware magic
-fore200e_pca_fw.c: $(patsubst "%", %, $(CONFIG_ATM_FORE200E_PCA_FW)) \
-         fore200e_mkfirm
-       ./fore200e_mkfirm -k -b _fore200e_pca_fw \
+$(obj)/fore200e_pca_fw.c: $(patsubst "%", %, $(CONFIG_ATM_FORE200E_PCA_FW)) \
+                         $(obj)/fore200e_mkfirm
+       $(obj)/fore200e_mkfirm -k -b _fore200e_pca_fw \
          -i $(CONFIG_ATM_FORE200E_PCA_FW) -o $@
-       @ ( \
-         echo 'ifeq ($(strip $(CONFIG_ATM_FORE200E_PCA_FW)), $$(CONFIG_ATM_FORE200E_PCA_FW))'; \
-         echo 'FORE200E_FW_UP_TO_DATE += $@'; \
-         echo 'endif' \
-       ) >.$@.fw
-
-fore200e_sba_fw.c: $(patsubst "%", %, $(CONFIG_ATM_FORE200E_SBA_FW)) \
-         fore200e_mkfirm
-       ./fore200e_mkfirm -k -b _fore200e_sba_fw \
+
+$(obj)/fore200e_sba_fw.c: $(patsubst "%", %, $(CONFIG_ATM_FORE200E_SBA_FW)) \
+                         $(obj)/fore200e_mkfirm
+       $(obj)/fore200e_mkfirm -k -b _fore200e_sba_fw \
          -i $(CONFIG_ATM_FORE200E_SBA_FW) -o $@
-       @ ( \
-         echo 'ifeq ($(strip $(CONFIG_ATM_FORE200E_SBA_FW)), $$(CONFIG_ATM_FORE200E_SBA_FW))'; \
-         echo 'FORE200E_FW_UP_TO_DATE += $@'; \
-         echo 'endif' \
-       ) >.$@.fw
 
 # deal with the various suffixes of the binary firmware images
-%.bin %.bin1 %.bin2: %.data
+$(obj)/%.bin $(obj)/%.bin1 $(obj)/%.bin2: $(obj)/%.data
        objcopy -Iihex $< -Obinary $@.gz
        gzip -df $@.gz
-
-# firmware dependency stuff taken from drivers/sound/Makefile
-FORE200E_FW_UP_TO_DATE :=
-
-FORE200E_FW_FILES := $(wildcard .fore200e_*.fw)
-ifneq ($(FORE200E_FW_FILES),)
-include $(FORE200E_FW_FILES)
-endif
-
-FORE200E_FW_CHANGED := $(filter-out $(FORE200E_FW_UP_TO_DATE), \
-                       fore200e_pca_fw.c fore200e_sba_fw.c)
-
-ifneq ($(FORE200E_FW_CHANGED),)
-$(FORE200E_FW_CHANGED): FORCE
-endif
index eefdbc1..ed6acf9 100644 (file)
@@ -31,5 +31,3 @@ obj-$(CONFIG_SUN_JSFLASH)             += jsflash.o
 obj-$(CONFIG_BBC_I2C)                  += bbc.o
 
 include $(TOPDIR)/Rules.make
-
-sunkbdmap.o: sunkeymap.c
index 915a968..da327d8 100644 (file)
@@ -131,32 +131,32 @@ cpqfc-objs        := cpqfcTSinit.o cpqfcTScontrol.o cpqfcTSi2c.o \
 
 include $(TOPDIR)/Rules.make
 
-53c7,8xx.o: 53c8xx_d.h 53c8xx_u.h
-53c7xx.o:   53c7xx_d.h 53c7xx_u.h
-sim710.o:   sim710_d.h
-53c700.o $(MODVERDIR)/53c700.ver: 53c700_d.h
+$(obj)/53c7,8xx.o: $(obj)/53c8xx_d.h $(obj)/53c8xx_u.h
+$(obj)/53c7xx.o:   $(obj)/53c7xx_d.h $(obj)/53c7xx_u.h
+$(obj)/sim710.o:   $(obj)/sim710_d.h
+$(obj)/53c700.o $(MODVERDIR)/53c700.ver: $(obj)/53c700_d.h
 
 # If you want to play with the firmware, uncomment
 # GENERATE_FIRMWARE := 1
 
 ifdef GENERATE_FIRMWARE
 
-53c8xx_d.h: 53c7,8xx.scr script_asm.pl
-       $(CPP) -traditional -DCHIP=810 - < $< | grep -v '^#' | $(PERL) script_asm.pl $@ $(@:_d.h=_u.h)
+$(obj)/53c8xx_d.h: $(src)/53c7,8xx.scr $(src)/script_asm.pl
+       $(CPP) -traditional -DCHIP=810 - < $< | grep -v '^#' | $(PERL) $(src)/script_asm.pl $@ $(@:_d.h=_u.h)
 
-53c8xx_u.h: 53c8xx_d.h
+$(obj)/53c8xx_u.h: $(obj)/53c8xx_d.h
 
-53c7xx_d.h: 53c7xx.scr script_asm.pl
-       $(CPP) -traditional -DCHIP=710 - < $< | grep -v '^#' | $(PERL) -s script_asm.pl -ncr7x0_family $@ $(@:_d.h=_u.h)
+$(obj)/53c7xx_d.h: $(src)/53c7xx.scr $(src)/script_asm.pl
+       $(CPP) -traditional -DCHIP=710 - < $< | grep -v '^#' | $(PERL) -s $(src)/script_asm.pl -ncr7x0_family $@ $(@:_d.h=_u.h)
 
-53c7xx_u.h: 53c7xx_d.h
+$(obj)/53c7xx_u.h: $(obj)/53c7xx_d.h
 
-sim710_d.h: sim710.scr script_asm.pl
-       $(CPP) -traditional -DCHIP=710 - < $< | grep -v '^#' | $(PERL) -s script_asm.pl -ncr7x0_family $@ $(@:_d.h=_u.h)
+$(obj)/sim710_d.h: $(src)/sim710.scr $(src)/script_asm.pl
+       $(CPP) -traditional -DCHIP=710 - < $< | grep -v '^#' | $(PERL) -s $(src)/script_asm.pl -ncr7x0_family $@ $(@:_d.h=_u.h)
 
-sim710_u.h: sim710_d.h
+$(obj)/sim710_u.h: $(obj)/sim710_d.h
 
-53c700_d.h: 53c700.scr script_asm.pl
-       $(PERL) -s script_asm.pl -ncr7x0_family $@ $(@:_d.h=_u.h) < $<
+$(obj)/53c700_d.h: $(src)/53c700.scr $(src)/script_asm.pl
+       $(PERL) -s $(src)/script_asm.pl -ncr7x0_family $@ $(@:_d.h=_u.h) < $<
 
 endif
\ No newline at end of file
index b669b0e..d92ba2b 100644 (file)
@@ -24,17 +24,20 @@ include $(TOPDIR)/Rules.make
 
 # Dependencies for generated files need to be listed explicitly
 
-aic7xxx_core.o: aic7xxx_seq.h
+$(obj)/aic7xxx_core.o: $(obj)/aic7xxx_seq.h
 
-$(aic7xxx-objs): aic7xxx_reg.h
+$(addprefix $(obj)/,$(aic7xxx-objs)): $(obj)/aic7xxx_reg.h
 
 ifeq ($(CONFIG_AIC7XXX_BUILD_FIRMWARE),y)
 
-aic7xxx_seq.h aic7xxx_reg.h: aic7xxx.seq aic7xxx.reg aicasm/aicasm
-       aicasm/aicasm -I. -r aic7xxx_reg.h -o aic7xxx_seq.h aic7xxx.seq
+$(obj)/aic7xxx_seq.h $(obj)/aic7xxx_reg.h: $(src)/aic7xxx.seq \
+                                          $(src)/aic7xxx.reg \
+                                          $(obj)/aicasm/aicasm
+       $(obj)/aicasm/aicasm -I. -r $(obj)/aic7xxx_reg.h \
+                                -o $(obj)/aic7xxx_seq.h $(src)/aic7xxx.seq
 
-aicasm/aicasm: aicasm/*.[chyl]
-       $(MAKE) -C aicasm
+$(obj)/aicasm/aicasm: $(src)/aicasm/*.[chyl]
+       $(MAKE) -C $(src)/aicasm
 
 endif
 
index 7d42321..9ba601d 100644 (file)
@@ -15,5 +15,5 @@ obj-$(CONFIG_VT) += lk201.o lk201-map.o lk201-remap.o
 
 include $(TOPDIR)/Rules.make
 
-lk201-map.c: lk201-map.map
-       loadkeys --mktable lk201-map.map > lk201-map.c
+$(obj)/lk201-map.c: $(src)/lk201-map.map
+       loadkeys --mktable $< > $@
index afafd24..e5a78eb 100644 (file)
@@ -20,19 +20,22 @@ include $(TOPDIR)/Rules.make
 
 # Dependencies on generated files need to be listed explicitly
 
-cl2llc.o: transit/pdutr.h transit/timertr.h pseudo/pseudocode.h
+$(obj)/cl2llc.o: $(obj)/transit/pdutr.h $(obj)/transit/timertr.h \
+                $(obj)/pseudo/pseudocode.h
 
 # Generated files
 
-transit/pdutr.h: transit/pdutr.pre transit/compile.awk                 
-       awk -f transit/compile.awk $< >$@
+$(obj)/transit/pdutr.h: $(src)/transit/pdutr.pre $(src)/transit/compile.awk
+       awk -f $(src)/transit/compile.awk $< >$@
 
-transit/timertr.h: transit/timertr.pre transit/compile.awk
-       awk -f transit/compile.awk $< >$@
+$(obj)/transit/timertr.h: $(src)/transit/timertr.pre $(src)/transit/compile.awk
+       awk -f $(src)/transit/compile.awk $< >$@
 
-pseudo/pseudocode.h: pseudo/pseudocode pseudo/opcd2num.sed \
-                    pseudo/compile.awk
-       sed -f pseudo/opcd2num.sed $< | awk -f pseudo/compile.awk >$@
+$(obj)/pseudo/pseudocode.h: $(src)/pseudo/pseudocode \
+                           $(src)/pseudo/opcd2num.sed \
+                           $(src)/pseudo/compile.awk
+       sed -f $(src)/pseudo/opcd2num.sed $< | \
+       awk -f $(src)/pseudo/compile.awk >$@
 
-cl2llc.c: cl2llc.pre pseudo/opcd2num.sed
-       sed -f pseudo/opcd2num.sed $< >$@
+$(obj)/cl2llc.c: $(src)/cl2llc.pre $(src)/pseudo/opcd2num.sed
+       sed -f $(src)/pseudo/opcd2num.sed $< >$@
index a5dbd86..0de4262 100644 (file)
@@ -14,9 +14,9 @@ include $(TOPDIR)/Rules.make
 
 # Dependencies on generated files need to be listed explicitly
 
-rfc_time.o: times.h
+$(obj)/rfc_time.o: $(obj)/times.h
 
 # Generated files
 
-times.h: make_times_h
-       ./$< >$@
+$(obj)/times.h: $(obj)/make_times_h
+       $< >$@
index 69fe6a4..2e22851 100644 (file)
@@ -108,127 +108,67 @@ include $(TOPDIR)/Rules.make
 
 # Turtle Beach Maui / Tropez
 
-maui.o: maui_boot.h
+$(obj)/maui.o: $(obj)/maui_boot.h
 
 ifeq ($(CONFIG_MAUI_HAVE_BOOT),y)
-    maui_boot.h: $(patsubst "%", %, $(CONFIG_MAUI_BOOT_FILE)) bin2hex
-       ./bin2hex -i maui_os < $(CONFIG_MAUI_BOOT_FILE) > $@
+    $(obj)/maui_boot.h: $(patsubst "%", %, $(CONFIG_MAUI_BOOT_FILE)) $(obj)/bin2hex
+       $(obj)/bin2hex -i maui_os < $< > $@
 else
-    maui_boot.h:
+    $(obj)/maui_boot.h:
        (                                                       \
            echo 'static unsigned char * maui_os = NULL;';      \
            echo 'static int maui_osLen = 0;';                  \
        ) > $@
 endif
-       @ ( \
-           echo 'ifeq ($(strip $(CONFIG_MAUI_HAVE_BOOT) $(CONFIG_MAUI_BOOT_FILE)),$$(strip $$(CONFIG_MAUI_HAVE_BOOT) $$(CONFIG_MAUI_BOOT_FILE)))'; \
-           echo 'FILES_BOOT_UP_TO_DATE += $@'; \
-           echo 'endif' \
-       ) > .$@.boot
-
-
 
 # Turtle Beach MultiSound
 
 ifeq ($(CONFIG_MSNDCLAS_HAVE_BOOT),y)
-    msnd_classic.o: msndperm.c msndinit.c
-
-    msndperm.c: $(patsubst "%", %, $(CONFIG_MSNDCLAS_PERM_FILE)) bin2hex
-       ./bin2hex msndperm < $(CONFIG_MSNDCLAS_PERM_FILE) > $@
-       @ ( \
-           echo 'ifeq ($(strip $(CONFIG_MSNDCLAS_HAVE_BOOT) $(CONFIG_MSNDCLAS_PERM_FILE)),$$(strip $$(CONFIG_MSNDCLAS_HAVE_BOOT) $$(CONFIG_MSNDCLAS_PERM_FILE)))'; \
-           echo 'FILES_BOOT_UP_TO_DATE += $@'; \
-           echo 'endif' \
-       ) > .$@.boot
-
-    msndinit.c: $(patsubst "%", %, $(CONFIG_MSNDCLAS_INIT_FILE)) bin2hex
-       ./bin2hex msndinit < $(CONFIG_MSNDCLAS_INIT_FILE) > $@
-       @ ( \
-           echo 'ifeq ($(strip $(CONFIG_MSNDCLAS_HAVE_BOOT) $(CONFIG_MSNDCLAS_INIT_FILE)),$$(strip $$(CONFIG_MSNDCLAS_HAVE_BOOT) $$(CONFIG_MSNDCLAS_INIT_FILE)))'; \
-           echo 'FILES_BOOT_UP_TO_DATE += $@'; \
-           echo 'endif' \
-       ) > .$@.boot
+    $(obj)/msnd_classic.o: $(obj)/msndperm.c $(obj)/msndinit.c
+
+    $(obj)/msndperm.c: $(patsubst "%", %, $(CONFIG_MSNDCLAS_PERM_FILE)) $(obj)/bin2hex
+       $(obj)/bin2hex msndperm < $< > $@
+
+    $(obj)/msndinit.c: $(patsubst "%", %, $(CONFIG_MSNDCLAS_INIT_FILE)) $(obj)/bin2hex
+       $(obj)/bin2hex msndinit < $< > $@
 endif
 
 ifeq ($(CONFIG_MSNDPIN_HAVE_BOOT),y)
-    msnd_pinnacle.o: pndsperm.c pndspini.c
-
-    pndsperm.c: $(patsubst "%", %, $(CONFIG_MSNDPIN_PERM_FILE)) bin2hex
-       ./bin2hex pndsperm < $(CONFIG_MSNDPIN_PERM_FILE) > $@
-       @ ( \
-           echo 'ifeq ($(strip $(CONFIG_MSNDPIN_HAVE_BOOT) $(CONFIG_MSNDPIN_PERM_FILE)),$$(strip $$(CONFIG_MSNDPIN_HAVE_BOOT) $$(CONFIG_MSNDPIN_PERM_FILE)))'; \
-           echo 'FILES_BOOT_UP_TO_DATE += $@'; \
-           echo 'endif' \
-       ) > .$@.boot
-
-    pndspini.c: $(patsubst "%", %, $(CONFIG_MSNDPIN_INIT_FILE)) bin2hex
-       ./bin2hex pndspini < $(CONFIG_MSNDPIN_INIT_FILE) > $@
-       @ ( \
-           echo 'ifeq ($(strip $(CONFIG_MSNDPIN_HAVE_BOOT) $(CONFIG_MSNDPIN_INIT_FILE)),$$(strip $$(CONFIG_MSNDPIN_HAVE_BOOT) $$(CONFIG_MSNDPIN_INIT_FILE)))'; \
-           echo 'FILES_BOOT_UP_TO_DATE += $@'; \
-           echo 'endif' \
-       ) > .$@.boot
-endif
+    $(obj)/msnd_pinnacle.o: $(obj)/pndsperm.c $(obj)/pndspini.c
 
+    $(obj)/pndsperm.c: $(patsubst "%", %, $(CONFIG_MSNDPIN_PERM_FILE)) $(obj)/bin2hex
+       $(obj)/bin2hex pndsperm < $< > $@
 
+    $(obj)/pndspini.c: $(patsubst "%", %, $(CONFIG_MSNDPIN_INIT_FILE)) $(obj)/bin2hex
+       $(obj)/bin2hex pndspini < $< > $@
+endif
 
 # PSS (ECHO-ADI2111)
 
-pss.o: pss_boot.h
+$(obj)/pss.o: $(obj)/pss_boot.h
 
 ifeq ($(CONFIG_PSS_HAVE_BOOT),y)
-    pss_boot.h: $(patsubst "%", %, $(CONFIG_PSS_BOOT_FILE)) bin2hex
-       ./bin2hex pss_synth < $(CONFIG_PSS_BOOT_FILE) > $@
+    $(obj)/pss_boot.h: $(patsubst "%", %, $(CONFIG_PSS_BOOT_FILE)) $(obj)/bin2hex
+       $(obj)/bin2hex pss_synth < $< > $@
 else
-    pss_boot.h:
+    $(obj)/pss_boot.h:
        (                                                       \
            echo 'static unsigned char * pss_synth = NULL;';    \
            echo 'static int pss_synthLen = 0;';                \
        ) > $@
 endif
-       @ ( \
-           echo 'ifeq ($(strip $(CONFIG_PSS_HAVE_BOOT) $(CONFIG_PSS_BOOT_FILE)),$$(strip $$(CONFIG_PSS_HAVE_BOOT) $$(CONFIG_PSS_BOOT_FILE)))'; \
-           echo 'FILES_BOOT_UP_TO_DATE += $@'; \
-           echo 'endif' \
-       ) > .$@.boot
-
-
 
 # MediaTrix AudioTrix Pro
 
-trix.o: trix_boot.h
+$(obj)/trix.o: $(obj)/trix_boot.h
 
 ifeq ($(CONFIG_TRIX_HAVE_BOOT),y)
-    trix_boot.h: $(patsubst "%", %, $(CONFIG_TRIX_BOOT_FILE)) hex2hex
-       ./hex2hex -i trix_boot < $(CONFIG_TRIX_BOOT_FILE) > $@
+    $(obj)/trix_boot.h: $(patsubst "%", %, $(CONFIG_TRIX_BOOT_FILE)) $(obj)/hex2hex
+       $(obj)/hex2hex -i trix_boot < $< > $@
 else
-    trix_boot.h:
+    $(obj)/trix_boot.h:
        (                                                       \
            echo 'static unsigned char * trix_boot = NULL;';    \
            echo 'static int trix_boot_len = 0;';               \
        ) > $@
 endif
-       @ ( \
-           echo 'ifeq ($(strip $(CONFIG_TRIX_HAVE_BOOT) $(CONFIG_TRIX_BOOT_FILE)),$$(strip $$(CONFIG_TRIX_HAVE_BOOT) $$(CONFIG_TRIX_BOOT_FILE)))'; \
-           echo 'FILES_BOOT_UP_TO_DATE += $@'; \
-           echo 'endif' \
-       ) > .$@.boot
-
-
-
-# Find boot files whose source file names have changed and force rebuild.
-
-FILES_BOOT_UP_TO_DATE :=
-
-FILES_BOOT_EXIST := $(wildcard .*.boot)
-ifneq ($(FILES_BOOT_EXIST),)
-include $(FILES_BOOT_EXIST)
-endif
-
-FILES_BOOT_CHANGED := $(strip \
-    $(filter-out $(FILES_BOOT_UP_TO_DATE), \
-       maui_boot.h pss_boot.h trix_boot.h))
-
-ifneq ($(FILES_BOOT_CHANGED),)
-$(FILES_BOOT_CHANGED): FORCE
-endif