All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Rearrange ftdump and convert-dtsv0 into sub-Makefiles.
@ 2008-10-03 17:13 Jon Loeliger
       [not found] ` <1223054016-22290-1-git-send-email-jdl-CYoMK+44s/E@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Jon Loeliger @ 2008-10-03 17:13 UTC (permalink / raw)
  To: devicetree-discuss-mnsaURCQ41sdnm+yROfE0A

Follows the model of the existing sub-Makefiles for dtc.

Adjust $(BIN) definition to represent installable bin programs
and use it as the list of installed programs rather than using
an enumerated list in the install target.

Adjust the tests/Makefile to clean up properly still.

Signed-off-by: Jon Loeliger <jdl-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
---
 Makefile               |   70 +++++++++++++++++++++++++----------------------
 Makefile.convert-dtsv0 |   12 ++++++++
 Makefile.ftdump        |   12 ++++++++
 tests/Makefile.tests   |    5 +--
 4 files changed, 63 insertions(+), 36 deletions(-)
 create mode 100644 Makefile.convert-dtsv0
 create mode 100644 Makefile.ftdump

diff --git a/Makefile b/Makefile
index 558e10c..b3b85a5 100644
--- a/Makefile
+++ b/Makefile
@@ -46,18 +46,6 @@ else
 DEPTARGETS = $(filter-out $(NODEPTARGETS),$(MAKECMDGOALS))
 endif
 
-all: dtc ftdump convert-dtsv0 libfdt
-
-install: all
-	@$(VECHO) INSTALL
-	$(INSTALL) -d $(DESTDIR)$(BINDIR)
-	$(INSTALL) -m 755 dtc $(DESTDIR)$(BINDIR)
-	$(INSTALL) -m 755 convert-dtsv0 $(DESTDIR)$(BINDIR)
-	$(INSTALL) -d $(DESTDIR)$(LIBDIR)
-	$(INSTALL) -m 644 $(LIBFDT_lib) $(DESTDIR)$(LIBDIR)
-	$(INSTALL) -d $(DESTDIR)$(INCLUDEDIR)
-	$(INSTALL) -m 644 $(LIBFDT_include) $(DESTDIR)$(INCLUDEDIR)
-
 #
 # Rules for versioning
 #
@@ -101,40 +89,27 @@ define filechk
 	fi;
 endef
 
-$(VERSION_FILE): Makefile FORCE
-	$(call filechk,version)
 
-#
-# Rules for dtc proper
-#
+include Makefile.convert-dtsv0
 include Makefile.dtc
+include Makefile.ftdump
 
+BIN += convert-dtsv0
 BIN += dtc
+BIN += ftdump
 
-# This stops make from generating the lex and bison output during
-# auto-dependency computation, but throwing them away as an
-# intermediate target and building them again "for real"
-.SECONDARY: $(DTC_GEN_SRCS)
 
-dtc: $(DTC_OBJS)
+all: $(BIN) libfdt
+
 
 ifneq ($(DEPTARGETS),)
 -include $(DTC_OBJS:%.o=%.d)
+-include $(CONVERT_OBJS:%.o=%.d)
+-include $(FTDUMP_OBJS:%.o=%.d)
 endif
-#
-# Rules for ftdump & convert-dtsv0
-#
-BIN += ftdump convert-dtsv0
 
-ftdump:	ftdump.o
 
-convert-dtsv0: convert-dtsv0-lexer.lex.o srcpos.o
-	@$(VECHO) LD $@
-	$(LINK.c) -o $@ $^
 
-ifneq ($(DEPTARGETS),)
--include ftdump.d
-endif
 #
 # Rules for libfdt
 #
@@ -158,6 +133,35 @@ ifneq ($(DEPTARGETS),)
 -include $(LIBFDT_OBJS:%.o=$(LIBFDT_objdir)/%.d)
 endif
 
+# This stops make from generating the lex and bison output during
+# auto-dependency computation, but throwing them away as an
+# intermediate target and building them again "for real"
+.SECONDARY: $(DTC_GEN_SRCS) $(CONVERT_GEN_SRCS)
+
+
+
+install: all
+	@$(VECHO) INSTALL
+	$(INSTALL) -d $(DESTDIR)$(BINDIR)
+	$(INSTALL) -m 755 $(BIN) $(DESTDIR)$(BINDIR)
+	$(INSTALL) -d $(DESTDIR)$(LIBDIR)
+	$(INSTALL) -m 644 $(LIBFDT_lib) $(DESTDIR)$(LIBDIR)
+	$(INSTALL) -d $(DESTDIR)$(INCLUDEDIR)
+	$(INSTALL) -m 644 $(LIBFDT_include) $(DESTDIR)$(INCLUDEDIR)
+
+$(VERSION_FILE): Makefile FORCE
+	$(call filechk,version)
+
+
+dtc: $(DTC_OBJS)
+
+convert-dtsv0: $(CONVERT_OBJS)
+	@$(VECHO) LD $@
+	$(LINK.c) -o $@ $^
+
+ftdump:	$(FTDUMP_OBJS)
+
+
 #
 # Testsuite rules
 #
diff --git a/Makefile.convert-dtsv0 b/Makefile.convert-dtsv0
new file mode 100644
index 0000000..a3f74c9
--- /dev/null
+++ b/Makefile.convert-dtsv0
@@ -0,0 +1,12 @@
+#
+# This is not a complete Makefile of itself.
+# Instead, it is designed to be easily embeddable
+# into other systems of Makefiles.
+#
+
+CONVERT_SRCS = \
+	srcpos.c
+
+CONVERT_GEN_SRCS = convert-dtsv0-lexer.lex.c
+
+CONVERT_OBJS = $(CONVERT_SRCS:%.c=%.o) $(CONVERT_GEN_SRCS:%.c=%.o)
diff --git a/Makefile.ftdump b/Makefile.ftdump
new file mode 100644
index 0000000..b70905a
--- /dev/null
+++ b/Makefile.ftdump
@@ -0,0 +1,12 @@
+#
+# This is not a complete Makefile of itself.
+# Instead, it is designed to be easily embeddable
+# into other systems of Makefiles.
+#
+
+FTDUMP_SRCS = \
+	ftdump.c
+
+FTDUMP_GEN_SRCS =
+
+FTDUMP_OBJS = $(FTDUMP_SRCS:%.c=%.o) $(FTDUMP_GEN_SRCS:%.c=%.o)
diff --git a/tests/Makefile.tests b/tests/Makefile.tests
index 5fd4d28..21a311e 100644
--- a/tests/Makefile.tests
+++ b/tests/Makefile.tests
@@ -29,9 +29,8 @@ TESTS_DEPFILES = $(TESTS:%=%.d) \
 	$(addprefix $(TESTS_PREFIX),testutils.d trees.d dumptrees.d)
 
 TESTS_CLEANFILES_L =  *.output vglog.* vgcore.* *.dtb *.test.dts *.dtsv1 tmp.*
-TESTS_CLEANFILES = $(TESTS_CLEANFILES_L:%=$(TESTS_PREFIX)%)
-
-BIN += $(TESTS) $(TESTS_PREFIX)dumptrees
+TESTS_CLEANFILES_L += dumptrees
+TESTS_CLEANFILES = $(TESTS) $(TESTS_CLEANFILES_L:%=$(TESTS_PREFIX)%)
 
 .PHONY: tests
 tests:	$(TESTS) $(TESTS_TREES)
-- 
1.6.0.90.g436ed

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Rearrange ftdump and convert-dtsv0 into sub-Makefiles.
       [not found] ` <1223054016-22290-1-git-send-email-jdl-CYoMK+44s/E@public.gmane.org>
@ 2008-10-04  2:40   ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2008-10-04  2:40 UTC (permalink / raw)
  To: Jon Loeliger; +Cc: devicetree-discuss-mnsaURCQ41sdnm+yROfE0A

On Fri, Oct 03, 2008 at 12:13:36PM -0500, Jon Loeliger wrote:
> Follows the model of the existing sub-Makefiles for dtc.
> 
> Adjust $(BIN) definition to represent installable bin programs
> and use it as the list of installed programs rather than using
> an enumerated list in the install target.
> 
> Adjust the tests/Makefile to clean up properly still.
> 
> Signed-off-by: Jon Loeliger <jdl-KZfg59tc24xl57MIdRCFDg@public.gmane.org>

Well.. the sub-Makefiles were originally implemented that way because
I thought it might be useful for people embedding dtc or libfdt.  At
least for the kernel this turned out not really to be the case, and
even so it seems like overkill for the little utilities.

But, whatever, I have no strong opinion on it.

Acked-by: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-04  2:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-03 17:13 [PATCH] Rearrange ftdump and convert-dtsv0 into sub-Makefiles Jon Loeliger
     [not found] ` <1223054016-22290-1-git-send-email-jdl-CYoMK+44s/E@public.gmane.org>
2008-10-04  2:40   ` David Gibson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.