diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2007-10-04 15:37:43 +1000 |
---|---|---|
committer | Jon Loeliger <jdl@freescale.com> | 2007-10-15 08:28:07 -0500 |
commit | ad9593f229362782b953da4b805df713e8468df0 (patch) | |
tree | 099cc29f97b5c047934587da8f419e2a5b7ea522 /Makefile.dtc | |
parent | d2a9da045897c37071597d9aa473964717b14735 (diff) | |
download | dtc-ad9593f229362782b953da4b805df713e8468df0.zip dtc-ad9593f229362782b953da4b805df713e8468df0.tar.gz dtc-ad9593f229362782b953da4b805df713e8468df0.tar.bz2 |
dtc: Refactor Makefiles
This patch makes a number of Makefile cleanups and improvements:
- We use more generic rules to invoke flex and bison, which is
useful for some of the other changes.
- We use the name dtc-lexer.lex.c for the flex output, instead
of the default lex.yy.c. That means less potential for confusion if
dtc is embedded into other projects (e.g. the kernel).
- We separate out a Makefile.dtc designed for embedding into
other projects, analagous to Makefile.libfdt.
- Makefile.libfdt is cleaned up to be more useful based on
some actual trial runs of embedding libfdt in the kernel bootwrapper.
- Versioning related rules and variables are collected into
one place in the Makefile.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'Makefile.dtc')
-rw-r--r-- | Makefile.dtc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Makefile.dtc b/Makefile.dtc new file mode 100644 index 0000000..c843ee2 --- /dev/null +++ b/Makefile.dtc @@ -0,0 +1,24 @@ +# Makefile.dtc +# +# This is not a complete Makefile of itself. Instead, it is designed to +# be easily embeddable into other systems of Makefiles. +# +DTC_SRCS = dtc.c flattree.c fstree.c data.c livetree.c treesource.c srcpos.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)) |