Skip to contentSkip to conversation

dtc: Further Makefile cleanups

PATCH David Gibson 1 participant 2 messages Nov 2, 2007 Kbuild

lore
Share & tools
lore
#0 lore raw

Informed by the experience attempting to embed dtc into the kernel tree, make further simplification of the Makefiles. In particular make the Makefile.dtc and Makefile.libfdt fragments truly minimal.

This change also stops linking dtc with libfdt, which it does not need.

---
 Makefile               |   13 +++++++------
 Makefile.dtc           |   20 ++------------------
 libfdt/Makefile.libfdt |    6 ------
 tests/Makefile.tests   |   49 ++++++++++++++++++++++---------------------------
 4 files changed, 31 insertions(+), 57 deletions(-)
Makefile +7 -6
Index: dtc/Makefile
===================================================================
@@ -17,7 +17,6 @@ CONFIG_LOCALVERSION =
 
 CPPFLAGS = -I libfdt
 CFLAGS = -Wall -g -Os
-LDFLAGS = -Llibfdt
 
 BISON = bison
 LEX = flex
@@ -138,15 +137,16 @@ LIBFDT_objdir = libfdt
 LIBFDT_srcdir = libfdt
 include libfdt/Makefile.libfdt
 
+LIBFDT_lib = $(LIBFDT_objdir)/libfdt.a
+
 .PHONY: libfdt
-libfdt: $(LIBFDT_LIB)
+libfdt: $(LIBFDT_lib)
 
-$(LIBFDT_LIB): $(addprefix libfdt/,$(LIBFDT_OBJS))
+$(LIBFDT_lib): $(addprefix $(LIBFDT_objdir)/,$(LIBFDT_OBJS))
 
 libfdt_clean:
 	@$(VECHO) CLEAN "(libfdt)"
 	rm -f $(addprefix libfdt/,$(STD_CLEANFILES))
-	rm -f $(addprefix libfdt/,$(LIBFDT_CLEANFILES))
 
 ifneq ($(DEPTARGETS),)
 -include $(LIBFDT_OBJS:%.o=$(LIBFDT_objdir)/%.d)
@@ -155,7 +155,8 @@ endif
 #
 # Testsuite rules
 #
-TESTS_PREFIX=tests/
+TESTS_srcdir = tests
+TESTS_objdir = tests
 include tests/Makefile.tests
 
 #
@@ -166,7 +167,7 @@ STD_CLEANFILES = *~ *.o *.d *.a *.i *.s 
 
 clean: libfdt_clean tests_clean
 	@$(VECHO) CLEAN
-	rm -f $(STD_CLEANFILES) $(DTC_CLEANFILES)
+	rm -f $(STD_CLEANFILES)
 	rm -f $(VERSION_FILE)
 	rm -f $(BIN)
 
libfdt/Makefile.libfdt +0 -6
Index: dtc/libfdt/Makefile.libfdt
===================================================================
@@ -4,11 +4,5 @@
 # be easily embeddable into other systems of Makefiles.
 #
 LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c
-LIBFDT_INCLUDES = fdt.h libfdt.h
-LIBFDT_EXTRA = libfdt_internal.h
-LIBFDT_LIB = libfdt/libfdt.a
-
 LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o)
 
-$(LIBFDT_objdir)/$(LIBFDT_LIB): $(addprefix $(LIBFDT_objdir)/,$(LIBFDT_OBJS))
-
tests/Makefile.tests +22 -27

76 lines not on this page · raw message

Makefile.dtc +2 -18
Index: dtc/Makefile.dtc
===================================================================
@@ -5,21 +5,5 @@
 #
 DTC_SRCS = dtc.c flattree.c fstree.c data.c livetree.c treesource.c srcpos.c \
 	checks.c
-DTC_EXTRA = dtc.h srcpos.h
-DTC_LEXFILES = dtc-lexer.l
-DTC_BISONFILES = dtc-parser.y
-
-DTC_LEX_SRCS = $(DTC_LEXFILES:%.l=%.lex.c)
-DTC_BISON_SRCS = $(DTC_BISONFILES:%.y=%.tab.c)
-DTC_BISON_INCLUDES = $(DTC_BISONFILES:%.y=%.tab.h)
-
-DTC_GEN_SRCS = $(DTC_LEX_SRCS) $(DTC_BISON_SRCS)
-DTC_GEN_ALL = $(DTC_GEN_SRCS) $(DTC_BISON_INCLUDES)
-DTC_OBJS = $(DTC_SRCS:%.c=%.o) $(DTC_GEN_SRCS:%.c=%.o)
-
-DTC_CLEANFILES = $(DTC_GEN_ALL)
-
-# We assume the containing Makefile system can do auto-dependencies for most
-# things, but we supply the dependencies on generated header files explicitly
-
-$(addprefix $(DTC_objdir)/,$(DTC_GEN_SRCS:%.c=%.o)): $(addprefix $(DTC_objdir)/,$(DTC_BISON_INCLUDES))
+DTC_GEN_SRCS = dtc-lexer.lex.c dtc-parser.tab.[ch]
+DTC_OBJS = $(DTC_SRCS:%.c=%.o) dtc-lexer.lex.o dtc-parser.tab.o
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#1 lore raw
Quoted 8 lines · David Gibson

Informed by the experience attempting to embed dtc into the kernel tree, make further simplification of the Makefiles. In particular make the Makefile.dtc and Makefile.libfdt fragments truly minimal.

This change also stops linking dtc with libfdt, which it does not need.

Sod. Don't apply, I screwed this one up somewhere along the line.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson