Commit a71684b9 authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Add $(obj), $(src) for generated files

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.
parent 6ce09c43
...@@ -20,5 +20,5 @@ obj-y += $(obj-$(MACHINE)) ...@@ -20,5 +20,5 @@ obj-y += $(obj-$(MACHINE))
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
%.c: %.map $(obj)/%.c: $(src)/%.map
loadkeys --mktable $< > $@ loadkeys --mktable $< > $@
...@@ -52,52 +52,26 @@ endif ...@@ -52,52 +52,26 @@ endif
obj-$(CONFIG_ATM_FORE200E) += fore_200e.o obj-$(CONFIG_ATM_FORE200E) += fore_200e.o
EXTRA_CFLAGS=-g
fore_200e-objs := fore200e.o $(FORE200E_FW_OBJS) fore_200e-objs := fore200e.o $(FORE200E_FW_OBJS)
host-progs := fore200e_mkfirm host-progs := fore200e_mkfirm
include $(TOPDIR)/Rules.make EXTRA_CFLAGS := -g
include $(TOPDIR)/Rules.make
# FORE Systems 200E-series firmware magic # FORE Systems 200E-series firmware magic
fore200e_pca_fw.c: $(patsubst "%", %, $(CONFIG_ATM_FORE200E_PCA_FW)) \ $(obj)/fore200e_pca_fw.c: $(patsubst "%", %, $(CONFIG_ATM_FORE200E_PCA_FW)) \
fore200e_mkfirm $(obj)/fore200e_mkfirm
./fore200e_mkfirm -k -b _fore200e_pca_fw \ $(obj)/fore200e_mkfirm -k -b _fore200e_pca_fw \
-i $(CONFIG_ATM_FORE200E_PCA_FW) -o $@ -i $(CONFIG_ATM_FORE200E_PCA_FW) -o $@
@ ( \
echo 'ifeq ($(strip $(CONFIG_ATM_FORE200E_PCA_FW)), $$(CONFIG_ATM_FORE200E_PCA_FW))'; \ $(obj)/fore200e_sba_fw.c: $(patsubst "%", %, $(CONFIG_ATM_FORE200E_SBA_FW)) \
echo 'FORE200E_FW_UP_TO_DATE += $@'; \ $(obj)/fore200e_mkfirm
echo 'endif' \ $(obj)/fore200e_mkfirm -k -b _fore200e_sba_fw \
) >.$@.fw
fore200e_sba_fw.c: $(patsubst "%", %, $(CONFIG_ATM_FORE200E_SBA_FW)) \
fore200e_mkfirm
./fore200e_mkfirm -k -b _fore200e_sba_fw \
-i $(CONFIG_ATM_FORE200E_SBA_FW) -o $@ -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 # 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 objcopy -Iihex $< -Obinary $@.gz
gzip -df $@.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
...@@ -31,5 +31,3 @@ obj-$(CONFIG_SUN_JSFLASH) += jsflash.o ...@@ -31,5 +31,3 @@ obj-$(CONFIG_SUN_JSFLASH) += jsflash.o
obj-$(CONFIG_BBC_I2C) += bbc.o obj-$(CONFIG_BBC_I2C) += bbc.o
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
sunkbdmap.o: sunkeymap.c
...@@ -131,32 +131,32 @@ cpqfc-objs := cpqfcTSinit.o cpqfcTScontrol.o cpqfcTSi2c.o \ ...@@ -131,32 +131,32 @@ cpqfc-objs := cpqfcTSinit.o cpqfcTScontrol.o cpqfcTSi2c.o \
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
53c7,8xx.o: 53c8xx_d.h 53c8xx_u.h $(obj)/53c7,8xx.o: $(obj)/53c8xx_d.h $(obj)/53c8xx_u.h
53c7xx.o: 53c7xx_d.h 53c7xx_u.h $(obj)/53c7xx.o: $(obj)/53c7xx_d.h $(obj)/53c7xx_u.h
sim710.o: sim710_d.h $(obj)/sim710.o: $(obj)/sim710_d.h
53c700.o $(MODVERDIR)/53c700.ver: 53c700_d.h $(obj)/53c700.o $(MODVERDIR)/53c700.ver: $(obj)/53c700_d.h
# If you want to play with the firmware, uncomment # If you want to play with the firmware, uncomment
# GENERATE_FIRMWARE := 1 # GENERATE_FIRMWARE := 1
ifdef GENERATE_FIRMWARE ifdef GENERATE_FIRMWARE
53c8xx_d.h: 53c7,8xx.scr script_asm.pl $(obj)/53c8xx_d.h: $(src)/53c7,8xx.scr $(src)/script_asm.pl
$(CPP) -traditional -DCHIP=810 - < $< | grep -v '^#' | $(PERL) script_asm.pl $@ $(@:_d.h=_u.h) $(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 $(obj)/53c7xx_d.h: $(src)/53c7xx.scr $(src)/script_asm.pl
$(CPP) -traditional -DCHIP=710 - < $< | grep -v '^#' | $(PERL) -s script_asm.pl -ncr7x0_family $@ $(@:_d.h=_u.h) $(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 $(obj)/sim710_d.h: $(src)/sim710.scr $(src)/script_asm.pl
$(CPP) -traditional -DCHIP=710 - < $< | grep -v '^#' | $(PERL) -s script_asm.pl -ncr7x0_family $@ $(@:_d.h=_u.h) $(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 $(obj)/53c700_d.h: $(src)/53c700.scr $(src)/script_asm.pl
$(PERL) -s script_asm.pl -ncr7x0_family $@ $(@:_d.h=_u.h) < $< $(PERL) -s $(src)/script_asm.pl -ncr7x0_family $@ $(@:_d.h=_u.h) < $<
endif endif
\ No newline at end of file
...@@ -24,17 +24,20 @@ include $(TOPDIR)/Rules.make ...@@ -24,17 +24,20 @@ include $(TOPDIR)/Rules.make
# Dependencies for generated files need to be listed explicitly # 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) ifeq ($(CONFIG_AIC7XXX_BUILD_FIRMWARE),y)
aic7xxx_seq.h aic7xxx_reg.h: aic7xxx.seq aic7xxx.reg aicasm/aicasm $(obj)/aic7xxx_seq.h $(obj)/aic7xxx_reg.h: $(src)/aic7xxx.seq \
aicasm/aicasm -I. -r aic7xxx_reg.h -o aic7xxx_seq.h 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] $(obj)/aicasm/aicasm: $(src)/aicasm/*.[chyl]
$(MAKE) -C aicasm $(MAKE) -C $(src)/aicasm
endif endif
...@@ -15,5 +15,5 @@ obj-$(CONFIG_VT) += lk201.o lk201-map.o lk201-remap.o ...@@ -15,5 +15,5 @@ obj-$(CONFIG_VT) += lk201.o lk201-map.o lk201-remap.o
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
lk201-map.c: lk201-map.map $(obj)/lk201-map.c: $(src)/lk201-map.map
loadkeys --mktable lk201-map.map > lk201-map.c loadkeys --mktable $< > $@
...@@ -20,19 +20,22 @@ include $(TOPDIR)/Rules.make ...@@ -20,19 +20,22 @@ include $(TOPDIR)/Rules.make
# Dependencies on generated files need to be listed explicitly # 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 # Generated files
transit/pdutr.h: transit/pdutr.pre transit/compile.awk $(obj)/transit/pdutr.h: $(src)/transit/pdutr.pre $(src)/transit/compile.awk
awk -f transit/compile.awk $< >$@ awk -f $(src)/transit/compile.awk $< >$@
transit/timertr.h: transit/timertr.pre transit/compile.awk $(obj)/transit/timertr.h: $(src)/transit/timertr.pre $(src)/transit/compile.awk
awk -f transit/compile.awk $< >$@ awk -f $(src)/transit/compile.awk $< >$@
pseudo/pseudocode.h: pseudo/pseudocode pseudo/opcd2num.sed \ $(obj)/pseudo/pseudocode.h: $(src)/pseudo/pseudocode \
pseudo/compile.awk $(src)/pseudo/opcd2num.sed \
sed -f pseudo/opcd2num.sed $< | awk -f pseudo/compile.awk >$@ $(src)/pseudo/compile.awk
sed -f $(src)/pseudo/opcd2num.sed $< | \
awk -f $(src)/pseudo/compile.awk >$@
cl2llc.c: cl2llc.pre pseudo/opcd2num.sed $(obj)/cl2llc.c: $(src)/cl2llc.pre $(src)/pseudo/opcd2num.sed
sed -f pseudo/opcd2num.sed $< >$@ sed -f $(src)/pseudo/opcd2num.sed $< >$@
...@@ -14,9 +14,9 @@ include $(TOPDIR)/Rules.make ...@@ -14,9 +14,9 @@ include $(TOPDIR)/Rules.make
# Dependencies on generated files need to be listed explicitly # Dependencies on generated files need to be listed explicitly
rfc_time.o: times.h $(obj)/rfc_time.o: $(obj)/times.h
# Generated files # Generated files
times.h: make_times_h $(obj)/times.h: $(obj)/make_times_h
./$< >$@ $< >$@
...@@ -108,127 +108,67 @@ include $(TOPDIR)/Rules.make ...@@ -108,127 +108,67 @@ include $(TOPDIR)/Rules.make
# Turtle Beach Maui / Tropez # Turtle Beach Maui / Tropez
maui.o: maui_boot.h $(obj)/maui.o: $(obj)/maui_boot.h
ifeq ($(CONFIG_MAUI_HAVE_BOOT),y) ifeq ($(CONFIG_MAUI_HAVE_BOOT),y)
maui_boot.h: $(patsubst "%", %, $(CONFIG_MAUI_BOOT_FILE)) bin2hex $(obj)/maui_boot.h: $(patsubst "%", %, $(CONFIG_MAUI_BOOT_FILE)) $(obj)/bin2hex
./bin2hex -i maui_os < $(CONFIG_MAUI_BOOT_FILE) > $@ $(obj)/bin2hex -i maui_os < $< > $@
else else
maui_boot.h: $(obj)/maui_boot.h:
( \ ( \
echo 'static unsigned char * maui_os = NULL;'; \ echo 'static unsigned char * maui_os = NULL;'; \
echo 'static int maui_osLen = 0;'; \ echo 'static int maui_osLen = 0;'; \
) > $@ ) > $@
endif 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 # Turtle Beach MultiSound
ifeq ($(CONFIG_MSNDCLAS_HAVE_BOOT),y) ifeq ($(CONFIG_MSNDCLAS_HAVE_BOOT),y)
msnd_classic.o: msndperm.c msndinit.c $(obj)/msnd_classic.o: $(obj)/msndperm.c $(obj)/msndinit.c
msndperm.c: $(patsubst "%", %, $(CONFIG_MSNDCLAS_PERM_FILE)) bin2hex $(obj)/msndperm.c: $(patsubst "%", %, $(CONFIG_MSNDCLAS_PERM_FILE)) $(obj)/bin2hex
./bin2hex msndperm < $(CONFIG_MSNDCLAS_PERM_FILE) > $@ $(obj)/bin2hex msndperm < $< > $@
@ ( \
echo 'ifeq ($(strip $(CONFIG_MSNDCLAS_HAVE_BOOT) $(CONFIG_MSNDCLAS_PERM_FILE)),$$(strip $$(CONFIG_MSNDCLAS_HAVE_BOOT) $$(CONFIG_MSNDCLAS_PERM_FILE)))'; \ $(obj)/msndinit.c: $(patsubst "%", %, $(CONFIG_MSNDCLAS_INIT_FILE)) $(obj)/bin2hex
echo 'FILES_BOOT_UP_TO_DATE += $@'; \ $(obj)/bin2hex msndinit < $< > $@
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
endif endif
ifeq ($(CONFIG_MSNDPIN_HAVE_BOOT),y) ifeq ($(CONFIG_MSNDPIN_HAVE_BOOT),y)
msnd_pinnacle.o: pndsperm.c pndspini.c $(obj)/msnd_pinnacle.o: $(obj)/pndsperm.c $(obj)/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)/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 (ECHO-ADI2111)
pss.o: pss_boot.h $(obj)/pss.o: $(obj)/pss_boot.h
ifeq ($(CONFIG_PSS_HAVE_BOOT),y) ifeq ($(CONFIG_PSS_HAVE_BOOT),y)
pss_boot.h: $(patsubst "%", %, $(CONFIG_PSS_BOOT_FILE)) bin2hex $(obj)/pss_boot.h: $(patsubst "%", %, $(CONFIG_PSS_BOOT_FILE)) $(obj)/bin2hex
./bin2hex pss_synth < $(CONFIG_PSS_BOOT_FILE) > $@ $(obj)/bin2hex pss_synth < $< > $@
else else
pss_boot.h: $(obj)/pss_boot.h:
( \ ( \
echo 'static unsigned char * pss_synth = NULL;'; \ echo 'static unsigned char * pss_synth = NULL;'; \
echo 'static int pss_synthLen = 0;'; \ echo 'static int pss_synthLen = 0;'; \
) > $@ ) > $@
endif 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 # MediaTrix AudioTrix Pro
trix.o: trix_boot.h $(obj)/trix.o: $(obj)/trix_boot.h
ifeq ($(CONFIG_TRIX_HAVE_BOOT),y) ifeq ($(CONFIG_TRIX_HAVE_BOOT),y)
trix_boot.h: $(patsubst "%", %, $(CONFIG_TRIX_BOOT_FILE)) hex2hex $(obj)/trix_boot.h: $(patsubst "%", %, $(CONFIG_TRIX_BOOT_FILE)) $(obj)/hex2hex
./hex2hex -i trix_boot < $(CONFIG_TRIX_BOOT_FILE) > $@ $(obj)/hex2hex -i trix_boot < $< > $@
else else
trix_boot.h: $(obj)/trix_boot.h:
( \ ( \
echo 'static unsigned char * trix_boot = NULL;'; \ echo 'static unsigned char * trix_boot = NULL;'; \
echo 'static int trix_boot_len = 0;'; \ 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 endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment