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 2007-06-14 15:05:55 +10:00
parent 400bd98a3a
commit 12578976fe
31 changed files with 95 additions and 105 deletions

3
.gitignore vendored
View File

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

View File

@ -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)

5
libfdt/.gitignore vendored
View File

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

View File

@ -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 $@" $< > $@

View File

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

View File

@ -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)

View File

@ -1,12 +1,67 @@
DTC = ../dtc
VG_DTC = valgrind --tool=memcheck ../dtc

check: all
./run_all_tests.sh
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

all:
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_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

$(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)

View File

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