Browse Source

Merge libfdt into dtc.

Having pulled the libfdt repository into dtc, merge the makefiles and
testsuites so that they build together usefully.
main
David Gibson 18 years ago
parent
commit
12578976fe
  1. 3
      .gitignore
  2. 36
      Makefile
  3. 5
      libfdt/.gitignore
  4. 28
      libfdt/Makefile
  5. 1
      libfdt/tests/.gitignore
  6. 62
      libfdt/tests/Makefile
  7. 61
      tests/Makefile
  8. 0
      tests/del_node.c
  9. 0
      tests/del_property.c
  10. 0
      tests/dumptrees.c
  11. 0
      tests/find_property.c
  12. 0
      tests/getprop.c
  13. 0
      tests/move_and_save.c
  14. 0
      tests/nop_node.c
  15. 0
      tests/nop_property.c
  16. 0
      tests/notfound.c
  17. 0
      tests/open_pack.c
  18. 0
      tests/path_offset.c
  19. 0
      tests/root_node.c
  20. 2
      tests/run_all_tests.sh
  21. 0
      tests/run_tests.sh
  22. 0
      tests/rw_tree1.c
  23. 0
      tests/setprop.c
  24. 0
      tests/setprop_inplace.c
  25. 0
      tests/subnode_offset.c
  26. 0
      tests/sw_tree1.c
  27. 0
      tests/testdata.h
  28. 0
      tests/tests.h
  29. 0
      tests/testutils.c
  30. 0
      tests/trees.S
  31. 0
      tests/truncated_property.c

3
.gitignore vendored

@ -1,5 +1,8 @@ @@ -1,5 +1,8 @@
*.o
*.d
*.a
*.so
*~
*.tab.[ch]
lex.yy.c
dtc

36
Makefile

@ -9,7 +9,9 @@ DTC_OBJS = dtc.o flattree.o fstree.o data.o livetree.o \ @@ -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) @@ -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 @@ -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)

5
libfdt/.gitignore vendored

@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
*.d
*.o
*.a
*.so
*~

28
libfdt/Makefile

@ -26,35 +26,12 @@ endif @@ -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) @@ -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 $@" $< > $@

1
libfdt/tests/.gitignore vendored

@ -1 +0,0 @@ @@ -1 +0,0 @@
*.dtb

62
libfdt/tests/Makefile

@ -1,62 +0,0 @@ @@ -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)

61
tests/Makefile

@ -1,12 +1,67 @@ @@ -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)

0
libfdt/tests/del_node.c → tests/del_node.c

0
libfdt/tests/del_property.c → tests/del_property.c

0
libfdt/tests/dumptrees.c → tests/dumptrees.c

0
libfdt/tests/find_property.c → tests/find_property.c

0
libfdt/tests/getprop.c → tests/getprop.c

0
libfdt/tests/move_and_save.c → tests/move_and_save.c

0
libfdt/tests/nop_node.c → tests/nop_node.c

0
libfdt/tests/nop_property.c → tests/nop_property.c

0
libfdt/tests/notfound.c → tests/notfound.c

0
libfdt/tests/open_pack.c → tests/open_pack.c

0
libfdt/tests/path_offset.c → tests/path_offset.c

0
libfdt/tests/root_node.c → tests/root_node.c

2
tests/run_all_tests.sh

@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
#! /bin/sh

0
libfdt/tests/run_tests.sh → tests/run_tests.sh

0
libfdt/tests/rw_tree1.c → tests/rw_tree1.c

0
libfdt/tests/setprop.c → tests/setprop.c

0
libfdt/tests/setprop_inplace.c → tests/setprop_inplace.c

0
libfdt/tests/subnode_offset.c → tests/subnode_offset.c

0
libfdt/tests/sw_tree1.c → tests/sw_tree1.c

0
libfdt/tests/testdata.h → tests/testdata.h

0
libfdt/tests/tests.h → tests/tests.h

0
libfdt/tests/testutils.c → tests/testutils.c

0
libfdt/tests/trees.S → tests/trees.S

0
libfdt/tests/truncated_property.c → tests/truncated_property.c

Loading…
Cancel
Save