aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2014-12-15 18:33:26 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2014-12-15 18:33:26 +1100
commit123071788f97a6c1acefbf0841f7d07126ab99ef (patch)
tree5e609aa06682e17dfaa4d165c93b952c703f3269
parent5c0cc57a31c826541f89884234fe566751fba99a (diff)
downloadskiboot-123071788f97a6c1acefbf0841f7d07126ab99ef.zip
skiboot-123071788f97a6c1acefbf0841f7d07126ab99ef.tar.gz
skiboot-123071788f97a6c1acefbf0841f7d07126ab99ef.tar.bz2
Fix makefile dependency generation, especially for HOSTCC
Instead of having individual rules to generate .d, add -MMD to HOSTCC parameters, and just include the generated .d files. This fixes a few weird dependency issues. Also, make the mambo hello_kernel test depend on skiboot.lid Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--Makefile.main2
-rw-r--r--core/test/Makefile.check9
-rw-r--r--hdata/test/Makefile.check2
-rw-r--r--hw/ipmi/test/Makefile.check5
-rw-r--r--libc/test/Makefile.check7
-rw-r--r--libflash/test/Makefile.check2
-rw-r--r--test/hello_world/Makefile.check6
7 files changed, 8 insertions, 25 deletions
diff --git a/Makefile.main b/Makefile.main
index 5f8691a..d4249f0 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -29,7 +29,7 @@ CWARNS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
# Host tools and options
HOSTCC=gcc
HOSTEND=$(shell uname -m | sed -e 's/^i.*86$$/LITTLE/' -e 's/^x86.*/LITTLE/' -e 's/^ppc.*/BIG/')
-HOSTCFLAGS=-O1 $(CWARNS) -DHAVE_$(HOSTEND)_ENDIAN
+HOSTCFLAGS=-O1 $(CWARNS) -DHAVE_$(HOSTEND)_ENDIAN -MMD
VALGRIND=valgrind -q --show-reachable=yes --error-exitcode=99
# Target options
diff --git a/core/test/Makefile.check b/core/test/Makefile.check
index 7ffbfc4..15a662f 100644
--- a/core/test/Makefile.check
+++ b/core/test/Makefile.check
@@ -19,18 +19,9 @@ $(CORE_TEST) : core/test/stubs.o
$(CORE_TEST) : % : %.c
$(HOSTCC) $(HOSTCFLAGS) -O0 -g -I include -I . -I libfdt -o $@ $< core/test/stubs.o
-$(CORE_TEST): % : %.d
-
$(CORE_TEST:%=%-gcov): %-gcov : %.c %
$(HOSTCC) $(HOSTCFLAGS) -fprofile-arcs -ftest-coverage -O0 -g -I include -I . -I libfdt -lgcov -o $@ $< core/test/stubs.o
-$(CORE_TEST:%=%-gcov): % : $(%.d:-gcov=)
-
-core/test/stubs.o: core/test/stubs.d
-
-core/test/%.d: core/test/%.c
- $(HOSTCC) $(HOSTCFLAGS) -I include -I . -I libfdt -M $< > $@
-
-include $(wildcard core/test/*.d)
clean: core-test-clean
diff --git a/hdata/test/Makefile.check b/hdata/test/Makefile.check
index 63fcb4a..39e7c1e 100644
--- a/hdata/test/Makefile.check
+++ b/hdata/test/Makefile.check
@@ -12,6 +12,8 @@ hdata/test/stubs.o: hdata/test/stubs.c
hdata/test/hdata_to_dt: hdata/test/hdata_to_dt.c hdata/test/stubs.o
$(HOSTCC) $(HOSTCFLAGS) -DTEST -O0 -g -I hdata -I include -I . -I libfdt -o $@ $< hdata/test/stubs.o
+-include $(wildcard hdata/test/*.d)
+
clean: hdata-test-clean
hdata-test-clean:
diff --git a/hw/ipmi/test/Makefile.check b/hw/ipmi/test/Makefile.check
index 364a921..59c7a9b 100644
--- a/hw/ipmi/test/Makefile.check
+++ b/hw/ipmi/test/Makefile.check
@@ -14,16 +14,11 @@ $(IPMI_TEST:%=%-check) : %-check: %
$(IPMI_TEST) : % : %.c
$(HOSTCC) $(HOSTCFLAGS) -O0 -g -I include -I . -o $@ $<
-$(IPMI_TEST): % : %.d
-
$(IPMI_TEST:%=%-gcov): %-gcov : %.c %
$(HOSTCC) $(HOSTCFLAGS) -fprofile-arcs -ftest-coverage -O0 -g -I include -I . -I libfdt -lgcov -o $@ $<
$(IPMI_TEST:%=%-gcov): % : $(%.d:-gcov=)
-hw/ipmi/test/%.d: hw/ipmi/test/%.c
- $(HOSTCC) $(HOSTCFLAGS) -I include -I . -I libfdt -M $< > $@
-
-include $(wildcard hw/ipmi/test/*.d)
clean: ipmi-test-clean
diff --git a/libc/test/Makefile.check b/libc/test/Makefile.check
index dc9f1ff..57f6cf7 100644
--- a/libc/test/Makefile.check
+++ b/libc/test/Makefile.check
@@ -14,16 +14,9 @@ $(LIBC_TEST:%=%-check) : %-check: %
$(LIBC_TEST) : % : %.c
$(HOSTCC) $(HOSTCFLAGS) -O0 -g -I include -I . -I libfdt -I libc/include -o $@ $<
-$(LIBC_TEST): % : %.d
-
$(LIBC_TEST:%=%-gcov): %-gcov : %.c %
$(HOSTCC) $(HOSTCFLAGS) -fprofile-arcs -ftest-coverage -lgcov -O0 -g -I include -I . -I libfdt -I libc/include -o $@ $<
-$(LIBC_TEST:%=%-gcov): % : $(%.d:-gcov=)
-
-libc/test/%.d: libc/test/%.c
- $(HOSTCC) $(HOSTCFLAGS) -I include -I . -I libfdt -I libc/include -M $< > $@
-
-include $(wildcard libc/test/*.d)
clean: libc-test-clean
diff --git a/libflash/test/Makefile.check b/libflash/test/Makefile.check
index 54a7890..d6aac3c 100644
--- a/libflash/test/Makefile.check
+++ b/libflash/test/Makefile.check
@@ -22,7 +22,7 @@ $(LIBFLASH_TEST) : % : %.c
$(LIBFLASH_TEST:%=%-gcov): %-gcov : %.c %
$(HOSTCC) $(HOSTCFLAGS) -fprofile-arcs -ftest-coverage -lgcov -O0 -g -I include -I . -o $@ $< libflash/test/stubs.o
-$(LIBFLASH_TEST:%=%-gcov): % : $(%.d:-gcov=)
+-include $(wildcard libflash/test/*.d)
clean: libflash-test-clean
diff --git a/test/hello_world/Makefile.check b/test/hello_world/Makefile.check
index 6e94da7..a2a430c 100644
--- a/test/hello_world/Makefile.check
+++ b/test/hello_world/Makefile.check
@@ -2,14 +2,16 @@ HELLO_WORLD_TEST := test/hello_world/hello_kernel/hello_kernel
check: $(HELLO_WORLD_TEST:%=%-check)
-$(HELLO_WORLD_TEST:%=%-check) : %-check: %
+$(HELLO_WORLD_TEST:%=%-check) : %-check: % skiboot.lid
./test/hello_world/run_hello_world.sh
test/hello_world/hello_kernel/hello_kernel.o: test/hello_world/hello_kernel/hello_kernel.S
- $(call Q,CC, $(CC) -m64 -c -Itest/hello_world/hello_kernel/ -o $@ $^ ,$@)
+ $(call Q,CC, $(CC) -m64 -c -MMD -Itest/hello_world/hello_kernel/ -o $@ $^ ,$@)
hello_kernel_LDFLAGS=-m64 -Wl,--build-id=none -T test/hello_world/hello_kernel/hello_kernel.ld -ffreestanding -nostdlib -Ttext=0x0 -lgcc
+-include $(wildcard test/hello_world/hello_kernel/*.d)
+
test/hello_world/hello_kernel/hello_kernel: test/hello_world/hello_kernel/hello_kernel.o
$(call Q,LD, $(CC) $(hello_kernel_LDFLAGS) -o $@ $^ , $@)