From 12578976fe9cef82f0c08db3f9a4f550f5085ba4 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Thu, 14 Jun 2007 15:05:55 +1000 Subject: [PATCH] Merge libfdt into dtc. Having pulled the libfdt repository into dtc, merge the makefiles and testsuites so that they build together usefully. --- .gitignore | 3 + Makefile | 36 ++++++++++-- libfdt/.gitignore | 5 -- libfdt/Makefile | 28 +-------- libfdt/tests/.gitignore | 1 - libfdt/tests/Makefile | 62 -------------------- tests/Makefile | 61 ++++++++++++++++++- {libfdt/tests => tests}/del_node.c | 0 {libfdt/tests => tests}/del_property.c | 0 {libfdt/tests => tests}/dumptrees.c | 0 {libfdt/tests => tests}/find_property.c | 0 {libfdt/tests => tests}/getprop.c | 0 {libfdt/tests => tests}/move_and_save.c | 0 {libfdt/tests => tests}/nop_node.c | 0 {libfdt/tests => tests}/nop_property.c | 0 {libfdt/tests => tests}/notfound.c | 0 {libfdt/tests => tests}/open_pack.c | 0 {libfdt/tests => tests}/path_offset.c | 0 {libfdt/tests => tests}/root_node.c | 0 tests/run_all_tests.sh | 2 - {libfdt/tests => tests}/run_tests.sh | 0 {libfdt/tests => tests}/rw_tree1.c | 0 {libfdt/tests => tests}/setprop.c | 0 {libfdt/tests => tests}/setprop_inplace.c | 0 {libfdt/tests => tests}/subnode_offset.c | 0 {libfdt/tests => tests}/sw_tree1.c | 0 {libfdt/tests => tests}/testdata.h | 0 {libfdt/tests => tests}/tests.h | 0 {libfdt/tests => tests}/testutils.c | 0 {libfdt/tests => tests}/trees.S | 0 {libfdt/tests => tests}/truncated_property.c | 0 31 files changed, 94 insertions(+), 104 deletions(-) delete mode 100644 libfdt/.gitignore delete mode 100644 libfdt/tests/.gitignore delete mode 100644 libfdt/tests/Makefile rename {libfdt/tests => tests}/del_node.c (100%) rename {libfdt/tests => tests}/del_property.c (100%) rename {libfdt/tests => tests}/dumptrees.c (100%) rename {libfdt/tests => tests}/find_property.c (100%) rename {libfdt/tests => tests}/getprop.c (100%) rename {libfdt/tests => tests}/move_and_save.c (100%) rename {libfdt/tests => tests}/nop_node.c (100%) rename {libfdt/tests => tests}/nop_property.c (100%) rename {libfdt/tests => tests}/notfound.c (100%) rename {libfdt/tests => tests}/open_pack.c (100%) rename {libfdt/tests => tests}/path_offset.c (100%) rename {libfdt/tests => tests}/root_node.c (100%) delete mode 100644 tests/run_all_tests.sh rename {libfdt/tests => tests}/run_tests.sh (100%) rename {libfdt/tests => tests}/rw_tree1.c (100%) rename {libfdt/tests => tests}/setprop.c (100%) rename {libfdt/tests => tests}/setprop_inplace.c (100%) rename {libfdt/tests => tests}/subnode_offset.c (100%) rename {libfdt/tests => tests}/sw_tree1.c (100%) rename {libfdt/tests => tests}/testdata.h (100%) rename {libfdt/tests => tests}/tests.h (100%) rename {libfdt/tests => tests}/testutils.c (100%) rename {libfdt/tests => tests}/trees.S (100%) rename {libfdt/tests => tests}/truncated_property.c (100%) diff --git a/.gitignore b/.gitignore index 85ccca2..92f9a34 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ *.o *.d +*.a +*.so +*~ *.tab.[ch] lex.yy.c dtc diff --git a/Makefile b/Makefile index 280db78..2dcc5c9 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,9 @@ DTC_OBJS = dtc.o flattree.o fstree.o data.o livetree.o \ DEPFILES = $(DTC_OBJS:.o=.d) -all: $(TARGETS) +.PHONY: libfdt tests + +all: $(TARGETS) tests libfdt dtc: $(DTC_OBJS) $(LINK.c) -o $@ $^ @@ -17,6 +19,9 @@ dtc: $(DTC_OBJS) ftdump: ftdump.o $(LINK.c) -o $@ $^ +libfdt: + cd libfdt && $(MAKE) all + dtc-parser.tab.c dtc-parser.tab.h dtc-parser.output: dtc-parser.y $(BISON) -d $< @@ -25,17 +30,38 @@ lex.yy.c: dtc-lexer.l lex.yy.o: lex.yy.c dtc-parser.tab.h -check: all - cd tests && $(MAKE) check +tests: tests/all + +tests/%: libfdt + $(MAKE) -C tests $* + +check: all + cd tests; ./run_tests.sh + +checkv: all + cd tests; ./run_tests.sh -v + +func: all + cd tests; ./run_tests.sh -t func + +funcv: all + cd tests; ./run_tests.sh -t func -v + +stress: all + cd tests; ./run_tests.sh -t stress + +stressv: all + cd tests; ./run_tests.sh -t stress -v clean: rm -f *~ *.o a.out core $(TARGETS) rm -f *.tab.[ch] lex.yy.c rm -f *.i *.output vgcore.* rm -f *.d - cd tests && $(MAKE) clean + $(MAKE) -C libfdt clean + $(MAKE) -C tests clean %.d: %.c - $(CC) -MM -MG -MT "$*.o $@" $< > $@ + $(CC) $(CPPFLAGS) -MM -MG -MT "$*.o $@" $< > $@ -include $(DEPFILES) diff --git a/libfdt/.gitignore b/libfdt/.gitignore deleted file mode 100644 index 4b147f1..0000000 --- a/libfdt/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.d -*.o -*.a -*.so -*~ diff --git a/libfdt/Makefile b/libfdt/Makefile index c8240bb..3f68877 100644 --- a/libfdt/Makefile +++ b/libfdt/Makefile @@ -26,35 +26,12 @@ endif DEPFILES = $(LIBOBJS:%.o=%.d) -all: libs tests +all: libs -.PHONY: tests libs +.PHONY: libs libs: $(TARGETLIBS) -tests: tests/all - -tests/%: libs - $(MAKE) -C tests $* - -check: all - cd tests; ./run_tests.sh - -checkv: all - cd tests; ./run_tests.sh -v - -func: all - cd tests; ./run_tests.sh -t func - -funcv: all - cd tests; ./run_tests.sh -t func -v - -stress: all - cd tests; ./run_tests.sh -t stress - -stressv: all - cd tests; ./run_tests.sh -t stress -v - %.o: %.c @$(VECHO) CC $@ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $< @@ -74,7 +51,6 @@ libfdt.a: $(LIBOBJS) clean: @$(VECHO) CLEAN rm -f *~ *.o *.so *.a *.d *.i *.s core a.out $(VERSION) - $(MAKE) -C tests clean %.d: %.c @$(CC) $(CPPFLAGS) -MM -MT "$*.o $@" $< > $@ diff --git a/libfdt/tests/.gitignore b/libfdt/tests/.gitignore deleted file mode 100644 index b60ed20..0000000 --- a/libfdt/tests/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.dtb diff --git a/libfdt/tests/Makefile b/libfdt/tests/Makefile deleted file mode 100644 index 533c98e..0000000 --- a/libfdt/tests/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -PREFIX = /usr/local - -LIB_TESTS = root_node find_property subnode_offset path_offset getprop \ - notfound \ - setprop_inplace nop_property nop_node \ - sw_tree1 \ - move_and_save \ - open_pack rw_tree1 setprop del_property del_node -LIBTREE_TESTS = truncated_property -TESTS = $(LIB_TESTS) $(LIBTREE_TESTS) -UTILS = dumptrees - -TREES = test_tree1.dtb - -CFLAGS = -Wall -g -CPPFLAGS = -I.. -LDFLAGS = -L.. - -LIBFDT = ../libfdt.a - -ifdef V -VECHO = : -else -VECHO = echo " " -.SILENT: -endif - -DEPFILES = $(TESTS:%=%.d) testutils.d - -all: $(TESTS) $(TREES) - -%.o: %.c - @$(VECHO) CC $@ - $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $< - -%.o: %.S - @$(VECHO) AS $@ - $(CC) -D__ASSEMBLY__ $(CPPFLAGS) -o $@ -c $< - -%: %.o - @$(VECHO) LD $@ - $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) - -$(LIB_TESTS): %: testutils.o $(LIBFDT) - -$(LIBTREE_TESTS): %: testutils.o trees.o $(LIBFDT) - -dumptrees: %: trees.o - -$(TREES): dumptrees - @$(VECHO) DUMPTREES - ./dumptrees >/dev/null - -clean: - @$(VECHO) CLEAN "(tests)" - rm -f *~ *.o *.so *.a *.d *.s core a.out - rm -f $(TESTS) $(UTILS) *.dtb - -%.d: %.c - @$(CC) $(CPPFLAGS) -MM -MT "$*.o $@" $< > $@ - --include $(DEPFILES) diff --git a/tests/Makefile b/tests/Makefile index 912f832..5273028 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,12 +1,67 @@ DTC = ../dtc VG_DTC = valgrind --tool=memcheck ../dtc +LIB_TESTS = root_node find_property subnode_offset path_offset getprop \ + notfound \ + setprop_inplace nop_property nop_node \ + sw_tree1 \ + move_and_save \ + open_pack rw_tree1 setprop del_property del_node +LIBTREE_TESTS = truncated_property +TESTS = $(LIB_TESTS) $(LIBTREE_TESTS) +UTILS = dumptrees + +TREES = test_tree1.dtb + +CFLAGS = -Wall -g +CPPFLAGS = -I../libfdt +LDFLAGS = -L../libfdt + +LIBFDT = ../libfdt/libfdt.a + +ifdef V +VECHO = : +else +VECHO = echo " " +.SILENT: +endif + +DEPFILES = $(TESTS:%=%.d) testutils.d + check: all - ./run_all_tests.sh + ./run_tests.sh + +all: $(TESTS) $(TREES) + +%.o: %.c + @$(VECHO) CC $@ + $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $< + +%.o: %.S + @$(VECHO) AS $@ + $(CC) -D__ASSEMBLY__ $(CPPFLAGS) -o $@ -c $< + +%: %.o + @$(VECHO) LD $@ + $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) + +$(LIB_TESTS): %: testutils.o $(LIBFDT) + +$(LIBTREE_TESTS): %: testutils.o trees.o $(LIBFDT) + +dumptrees: %: trees.o -all: +$(TREES): dumptrees + @$(VECHO) DUMPTREES + ./dumptrees >/dev/null clean: - rm -f *~ + rm -f $(TESTS) + rm -f *.dtb dumptrees + rm -f *~ *.d *.o a.out core + rm -f *.i *.output vgcore.* +%.d: %.c + @$(CC) $(CPPFLAGS) -MM -MT "$*.o $@" $< > $@ +-include $(DEPFILES) diff --git a/libfdt/tests/del_node.c b/tests/del_node.c similarity index 100% rename from libfdt/tests/del_node.c rename to tests/del_node.c diff --git a/libfdt/tests/del_property.c b/tests/del_property.c similarity index 100% rename from libfdt/tests/del_property.c rename to tests/del_property.c diff --git a/libfdt/tests/dumptrees.c b/tests/dumptrees.c similarity index 100% rename from libfdt/tests/dumptrees.c rename to tests/dumptrees.c diff --git a/libfdt/tests/find_property.c b/tests/find_property.c similarity index 100% rename from libfdt/tests/find_property.c rename to tests/find_property.c diff --git a/libfdt/tests/getprop.c b/tests/getprop.c similarity index 100% rename from libfdt/tests/getprop.c rename to tests/getprop.c diff --git a/libfdt/tests/move_and_save.c b/tests/move_and_save.c similarity index 100% rename from libfdt/tests/move_and_save.c rename to tests/move_and_save.c diff --git a/libfdt/tests/nop_node.c b/tests/nop_node.c similarity index 100% rename from libfdt/tests/nop_node.c rename to tests/nop_node.c diff --git a/libfdt/tests/nop_property.c b/tests/nop_property.c similarity index 100% rename from libfdt/tests/nop_property.c rename to tests/nop_property.c diff --git a/libfdt/tests/notfound.c b/tests/notfound.c similarity index 100% rename from libfdt/tests/notfound.c rename to tests/notfound.c diff --git a/libfdt/tests/open_pack.c b/tests/open_pack.c similarity index 100% rename from libfdt/tests/open_pack.c rename to tests/open_pack.c diff --git a/libfdt/tests/path_offset.c b/tests/path_offset.c similarity index 100% rename from libfdt/tests/path_offset.c rename to tests/path_offset.c diff --git a/libfdt/tests/root_node.c b/tests/root_node.c similarity index 100% rename from libfdt/tests/root_node.c rename to tests/root_node.c diff --git a/tests/run_all_tests.sh b/tests/run_all_tests.sh deleted file mode 100644 index a8b7c3e..0000000 --- a/tests/run_all_tests.sh +++ /dev/null @@ -1,2 +0,0 @@ -#! /bin/sh - diff --git a/libfdt/tests/run_tests.sh b/tests/run_tests.sh similarity index 100% rename from libfdt/tests/run_tests.sh rename to tests/run_tests.sh diff --git a/libfdt/tests/rw_tree1.c b/tests/rw_tree1.c similarity index 100% rename from libfdt/tests/rw_tree1.c rename to tests/rw_tree1.c diff --git a/libfdt/tests/setprop.c b/tests/setprop.c similarity index 100% rename from libfdt/tests/setprop.c rename to tests/setprop.c diff --git a/libfdt/tests/setprop_inplace.c b/tests/setprop_inplace.c similarity index 100% rename from libfdt/tests/setprop_inplace.c rename to tests/setprop_inplace.c diff --git a/libfdt/tests/subnode_offset.c b/tests/subnode_offset.c similarity index 100% rename from libfdt/tests/subnode_offset.c rename to tests/subnode_offset.c diff --git a/libfdt/tests/sw_tree1.c b/tests/sw_tree1.c similarity index 100% rename from libfdt/tests/sw_tree1.c rename to tests/sw_tree1.c diff --git a/libfdt/tests/testdata.h b/tests/testdata.h similarity index 100% rename from libfdt/tests/testdata.h rename to tests/testdata.h diff --git a/libfdt/tests/tests.h b/tests/tests.h similarity index 100% rename from libfdt/tests/tests.h rename to tests/tests.h diff --git a/libfdt/tests/testutils.c b/tests/testutils.c similarity index 100% rename from libfdt/tests/testutils.c rename to tests/testutils.c diff --git a/libfdt/tests/trees.S b/tests/trees.S similarity index 100% rename from libfdt/tests/trees.S rename to tests/trees.S diff --git a/libfdt/tests/truncated_property.c b/tests/truncated_property.c similarity index 100% rename from libfdt/tests/truncated_property.c rename to tests/truncated_property.c