Skip to contentSkip to conversation

dtc: Improve and better integrate dtc and libfdt Makefiles

PATCH Applied David Gibson 2 participants 2 messages Jun 26, 2007 Kbuild

lore
Share & tools
lore
#0 lore raw

This patch substantially revamps the dtc Makefiles, in particular better integrating the Makefile for dtc proper with the Makefiles imported from libfdt for libfdt and the shared testsuite. Notable changes:
- No recursive make calls. Instead subsidiary Makefiles are
included into the top-level Makefile so we get a complete dependency information.
- Common pattern rules, CFLAGS etc. shared between dtc, libfdt
and testsuite, rather than separate copies.
- Vaguely Kbuild-like non-verbose mode used by default, which
makes warnings more prominent.
- libfdt Makefile consists only of variable definitions and
helper rules, to make it more easily embeddable into other Makefile systems.

libfdt/Makefile deleted +0 -64
Index: dtc/libfdt/Makefile
===================================================================
@@ -1,64 +0,0 @@
-PREFIX = /usr/local
-TARGETLIBS = libfdt.a
-LIBOBJS = fdt.o fdt_ro.o fdt_wip.o fdt_sw.o fdt_rw.o fdt_strerror.o
-
-SOURCE = $(shell find . -maxdepth 1 ! -name version.h -a -name '*.[h]')
-SOURCE += *.c Makefile
-NODEPTARGETS=<clean>
-
-CPPFLAGS = -I.
-CFLAGS = -Wall -g
-
-LIBDIR = $(PREFIX)/$(LIB32)
-
-EXTRA_DIST = \
-	README \
-	HOWTO \
-	LGPL-2.1
-
-ifdef V
-VECHO = :
-else
-VECHO = echo "	"
-ARFLAGS = rc
-.SILENT:
-endif
-
-DEPFILES = $(LIBOBJS:%.o=%.d)
-
-all:	libs
-
-.PHONY:	libs
-
-libs:	$(TARGETLIBS)
-
-%.o: %.c
-	@$(VECHO) CC $@
-	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
-
-libfdt.a: $(LIBOBJS)
-	@$(VECHO) AR $@
-	$(AR) $(ARFLAGS) $@ $^
-
-%.i:	%.c
-	@$(VECHO) CPP $@
-	$(CC) $(CPPFLAGS) -E $< > $@
-
-%.s:	%.c
-	@$(VECHO) CC -S $@
-	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -S $<
-
-clean:
-	@$(VECHO) CLEAN
-	rm -f *~ *.o *.so *.a *.d *.i *.s core a.out $(VERSION)
-
-%.d: %.c
-	@$(CC) $(CPPFLAGS) -MM -MT "$*.o $@" $< > $@
-
-# Workaround: Don't build dependencies for certain targets
-#    When the include below is executed, make will use the %.d target above to
-# generate missing files.  For certain targets (clean, version.h, etc) we don't
-# need or want these dependency files, so don't include them in this case.
-ifeq (,$(findstring <$(MAKECMDGOALS)>,$(NODEPTARGETS)))
--include $(DEPFILES)
-endif
Makefile +95 -47

162 lines not on this page · raw message

tests/Makefile deleted +0 -67

67 lines not on this page · raw message

libfdt/Makefile.libfdt new file +19 -0
Index: dtc/libfdt/Makefile.libfdt
===================================================================
@@ -0,0 +1,19 @@
+# Makefile.libfdt
+#
+# This is not a complete Makefile of itself.  Instead, it is designed to
+# be easily embeddable into other systems of Makefiles.
+#
+
+LIBFDT_OBJS_L = fdt.o fdt_ro.o fdt_wip.o fdt_sw.o fdt_rw.o fdt_strerror.o
+LIBFDT_OBJS = $(LIBFDT_OBJS_L:%=$(LIBFDT_PREFIX)%)
+
+LIBFDT_LIB_L = libfdt.a
+LIBFDT_LIB = $(LIBFDT_LIB_L:%=$(LIBFDT_PREFIX)%)
+
+LIBFDT_CLEANFILES_L = *~ *.o *.d *.a $(LIBFDT_LIB) \
+	*.i *.s a.out core
+LIBFDT_CLEANFILES = $(LIBFDT_CLEANFILES_L:%=$(LIBFDT_PREFIX)%)
+
+$(LIBFDT_LIB): $(LIBFDT_OBJS)
+
+LIBFDT_DEPFILES = $(LIBFDT_OBJS:%.o=%.d)
tests/Makefile.tests new file +65 -0

65 lines not on this page · raw message

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
Applied
#1 lore raw

So, like, the other day David Gibson mumbled:

Quoted 15 lines

This patch substantially revamps the dtc Makefiles, in particular better integrating the Makefile for dtc proper with the Makefiles imported from libfdt for libfdt and the shared testsuite. Notable changes:
- No recursive make calls. Instead subsidiary Makefiles are
included into the top-level Makefile so we get a complete dependency information.
- Common pattern rules, CFLAGS etc. shared between dtc, libfdt
and testsuite, rather than separate copies.
- Vaguely Kbuild-like non-verbose mode used by default, which
makes warnings more prominent.
- libfdt Makefile consists only of variable definitions and
helper rules, to make it more easily embeddable into other Makefile systems.

Quoted 1 line

I like.

Applied.

Thanks!
jdl