2007-07-07 20:52:25 +02:00
|
|
|
#
|
|
|
|
# Device Tree Compiler
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Version information will be constructed in this order:
|
|
|
|
# EXTRAVERSION might be "-rc", for example.
|
|
|
|
# LOCAL_VERSION is likely from command line.
|
|
|
|
# CONFIG_LOCALVERSION from some future config system.
|
|
|
|
#
|
|
|
|
VERSION = 1
|
|
|
|
PATCHLEVEL = 0
|
|
|
|
SUBLEVEL = 0
|
2007-07-25 17:53:42 +02:00
|
|
|
EXTRAVERSION =-rc1
|
2007-07-07 20:52:25 +02:00
|
|
|
LOCAL_VERSION =
|
|
|
|
CONFIG_LOCALVERSION =
|
|
|
|
|
|
|
|
DTC_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
|
|
|
|
VERSION_FILE = version_gen.h
|
|
|
|
|
|
|
|
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
|
|
|
|
else if [ -x /bin/bash ]; then echo /bin/bash; \
|
|
|
|
else echo sh; fi ; fi)
|
|
|
|
|
|
|
|
nullstring :=
|
|
|
|
space := $(nullstring) # end of line
|
|
|
|
|
|
|
|
localver_config = $(subst $(space),, $(string) \
|
|
|
|
$(patsubst "%",%,$(CONFIG_LOCALVERSION)))
|
|
|
|
|
|
|
|
localver_cmd = $(subst $(space),, $(string) \
|
|
|
|
$(patsubst "%",%,$(LOCALVERSION)))
|
|
|
|
|
|
|
|
localver_scm = $(shell $(CONFIG_SHELL) ./scripts/setlocalversion)
|
|
|
|
localver_full = $(localver_config)$(localver_cmd)$(localver_scm)
|
|
|
|
|
|
|
|
dtc_version = $(DTC_VERSION)$(localver_full)
|
|
|
|
|
|
|
|
#
|
|
|
|
# Contents of the generated version file.
|
|
|
|
#
|
|
|
|
define filechk_version
|
|
|
|
(echo "#define DTC_VERSION \"DTC $(dtc_version)\""; )
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
2007-06-26 04:45:51 +02:00
|
|
|
CPPFLAGS = -I libfdt
|
2005-06-08 09:18:34 +02:00
|
|
|
CFLAGS = -Wall -g
|
2007-06-26 04:45:51 +02:00
|
|
|
LDFLAGS = -Llibfdt
|
2005-06-08 09:18:34 +02:00
|
|
|
|
2005-06-16 06:36:37 +02:00
|
|
|
BISON = bison
|
|
|
|
|
2007-06-29 16:53:23 +02:00
|
|
|
INSTALL = /usr/bin/install
|
|
|
|
DESTDIR =
|
dtc: Improve the make install target
This patch makes various improvements to dtc's make install target:
- libfdt is also installed. Specifically, libfdt.a and the
two export relevant header files, fdt.h and libfdt.h are installed.
- ftdump is no longer installed. It was only ever a
development debugging tool and may well go away at some point.
- In keeping with normal conventions, there is now a PREFIX
variable, allowing control of where things are installed (in /usr,
/usr/local, /opt, etc.).
- By default, installed into the user's home directory,
instead of /usr. This is friendlier for self-installers, package
builders can easily override PREFIX to restore the old behaviour.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-07-24 07:14:52 +02:00
|
|
|
PREFIX = $(HOME)
|
|
|
|
BINDIR = $(PREFIX)/bin
|
|
|
|
LIBDIR = $(PREFIX)/lib
|
|
|
|
INCLUDEDIR = $(PREFIX)/include
|
2007-06-29 16:53:23 +02:00
|
|
|
|
2007-06-26 04:45:51 +02:00
|
|
|
#
|
|
|
|
# Overall rules
|
|
|
|
#
|
|
|
|
ifdef V
|
|
|
|
VECHO = :
|
|
|
|
else
|
|
|
|
VECHO = echo " "
|
|
|
|
ARFLAGS = rc
|
|
|
|
.SILENT:
|
|
|
|
endif
|
|
|
|
|
|
|
|
NODEPTARGETS = clean
|
|
|
|
ifeq ($(MAKECMDGOALS),)
|
|
|
|
DEPTARGETS = all
|
|
|
|
else
|
|
|
|
DEPTARGETS = $(filter-out $(NODEPTARGETS),$(MAKECMDGOALS))
|
|
|
|
endif
|
|
|
|
|
|
|
|
all: dtc ftdump libfdt tests
|
|
|
|
|
|
|
|
#
|
|
|
|
# Rules for dtc proper
|
|
|
|
#
|
|
|
|
DTC_PROGS = dtc ftdump
|
|
|
|
DTC_OBJS = dtc.o flattree.o fstree.o data.o livetree.o \
|
|
|
|
srcpos.o treesource.o \
|
|
|
|
dtc-parser.tab.o lex.yy.o
|
|
|
|
DTC_DEPFILES = $(DTC_OBJS:%.o=%.d)
|
2007-06-14 07:05:55 +02:00
|
|
|
|
2007-07-07 21:18:02 +02:00
|
|
|
BIN += dtc ftdump
|
|
|
|
|
2005-06-16 06:36:37 +02:00
|
|
|
dtc-parser.tab.c dtc-parser.tab.h dtc-parser.output: dtc-parser.y
|
2007-06-26 04:45:51 +02:00
|
|
|
@$(VECHO) BISON $@
|
2007-07-07 17:38:27 +02:00
|
|
|
@$(VECHO) ---- Expect 2 s/r and 2 r/r. ----
|
2005-07-15 09:14:24 +02:00
|
|
|
$(BISON) -d $<
|
2005-06-08 09:18:34 +02:00
|
|
|
|
2007-07-07 20:52:25 +02:00
|
|
|
$(VERSION_FILE): Makefile FORCE
|
|
|
|
$(call filechk,version)
|
|
|
|
|
2005-06-08 09:18:34 +02:00
|
|
|
lex.yy.c: dtc-lexer.l
|
2007-06-26 04:45:51 +02:00
|
|
|
@$(VECHO) LEX $@
|
2005-06-08 09:18:34 +02:00
|
|
|
$(LEX) $<
|
|
|
|
|
2007-06-26 04:45:51 +02:00
|
|
|
dtc: $(DTC_OBJS)
|
2007-07-07 21:18:02 +02:00
|
|
|
@$(VECHO) LD $@
|
|
|
|
$(LINK.c) -o $@ $^
|
2007-06-14 07:05:55 +02:00
|
|
|
|
2007-06-26 04:45:51 +02:00
|
|
|
ftdump: ftdump.o
|
2007-06-14 07:05:55 +02:00
|
|
|
|
2007-06-26 04:45:51 +02:00
|
|
|
ifneq ($(DEPTARGETS),)
|
|
|
|
-include $(DTC_DEPFILES)
|
|
|
|
endif
|
2007-06-14 07:05:55 +02:00
|
|
|
|
2007-06-26 04:45:51 +02:00
|
|
|
#
|
|
|
|
# Rules for libfdt
|
|
|
|
#
|
|
|
|
LIBFDT_PREFIX = libfdt/
|
|
|
|
include libfdt/Makefile.libfdt
|
2007-06-14 07:05:55 +02:00
|
|
|
|
2007-06-26 04:45:51 +02:00
|
|
|
.PHONY: libfdt
|
|
|
|
libfdt: $(LIBFDT_LIB)
|
2005-06-08 09:18:34 +02:00
|
|
|
|
2007-06-26 04:45:51 +02:00
|
|
|
libfdt_clean:
|
|
|
|
@$(VECHO) CLEAN "(libfdt)"
|
|
|
|
rm -f $(LIBFDT_CLEANFILES)
|
2005-06-08 09:18:34 +02:00
|
|
|
|
2007-06-26 04:45:51 +02:00
|
|
|
ifneq ($(DEPTARGETS),)
|
|
|
|
-include $(LIBFDT_DEPFILES)
|
|
|
|
endif
|
2005-07-11 08:29:25 +02:00
|
|
|
|
2007-06-26 04:45:51 +02:00
|
|
|
#
|
|
|
|
# Testsuite rules
|
|
|
|
#
|
|
|
|
TESTS_PREFIX=tests/
|
|
|
|
include tests/Makefile.tests
|
2007-06-29 16:53:23 +02:00
|
|
|
|
2007-07-07 21:18:02 +02:00
|
|
|
STD_CLEANFILES = *~ *.o *.d *.a *.i *.s core a.out
|
|
|
|
GEN_CLEANFILES = $(VERSION_FILE)
|
|
|
|
|
|
|
|
clean: libfdt_clean tests_clean
|
|
|
|
@$(VECHO) CLEAN
|
|
|
|
rm -f $(STD_CLEANFILES)
|
|
|
|
rm -f $(GEN_CLEANFILES)
|
|
|
|
rm -f *.tab.[ch] lex.yy.c *.output vgcore.*
|
|
|
|
rm -f $(BIN)
|
|
|
|
|
dtc: Improve the make install target
This patch makes various improvements to dtc's make install target:
- libfdt is also installed. Specifically, libfdt.a and the
two export relevant header files, fdt.h and libfdt.h are installed.
- ftdump is no longer installed. It was only ever a
development debugging tool and may well go away at some point.
- In keeping with normal conventions, there is now a PREFIX
variable, allowing control of where things are installed (in /usr,
/usr/local, /opt, etc.).
- By default, installed into the user's home directory,
instead of /usr. This is friendlier for self-installers, package
builders can easily override PREFIX to restore the old behaviour.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-07-24 07:14:52 +02:00
|
|
|
install: all
|
|
|
|
@$(VECHO) INSTALL
|
2007-06-29 16:53:23 +02:00
|
|
|
$(INSTALL) -d $(DESTDIR)$(BINDIR)
|
|
|
|
$(INSTALL) -m 755 dtc $(DESTDIR)$(BINDIR)
|
dtc: Improve the make install target
This patch makes various improvements to dtc's make install target:
- libfdt is also installed. Specifically, libfdt.a and the
two export relevant header files, fdt.h and libfdt.h are installed.
- ftdump is no longer installed. It was only ever a
development debugging tool and may well go away at some point.
- In keeping with normal conventions, there is now a PREFIX
variable, allowing control of where things are installed (in /usr,
/usr/local, /opt, etc.).
- By default, installed into the user's home directory,
instead of /usr. This is friendlier for self-installers, package
builders can easily override PREFIX to restore the old behaviour.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-07-24 07:14:52 +02:00
|
|
|
$(INSTALL) -d $(DESTDIR)$(LIBDIR)
|
|
|
|
$(INSTALL) -m 644 $(LIBFDT_LIB) $(DESTDIR)$(LIBDIR)
|
|
|
|
$(INSTALL) -d $(DESTDIR)$(INCLUDEDIR)
|
|
|
|
$(INSTALL) -m 644 $(LIBFDT_INCLUDES) $(DESTDIR)$(INCLUDEDIR)
|
2007-07-07 20:52:25 +02:00
|
|
|
|
|
|
|
define filechk
|
|
|
|
set -e; \
|
|
|
|
echo ' CHK $@'; \
|
|
|
|
mkdir -p $(dir $@); \
|
|
|
|
$(filechk_$(1)) < $< > $@.tmp; \
|
|
|
|
if [ -r $@ ] && cmp -s $@ $@.tmp; then \
|
|
|
|
rm -f $@.tmp; \
|
|
|
|
else \
|
|
|
|
echo ' UPD $@'; \
|
|
|
|
mv -f $@.tmp $@; \
|
|
|
|
fi;
|
|
|
|
endef
|
|
|
|
|
2007-07-07 21:18:02 +02:00
|
|
|
#
|
|
|
|
# Generic compile rules
|
|
|
|
#
|
|
|
|
%.o: %.c
|
|
|
|
@$(VECHO) CC $@
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
|
|
|
|
|
|
|
|
%.o: %.S
|
|
|
|
@$(VECHO) AS $@
|
|
|
|
$(CC) $(CPPFLAGS) $(AFLAGS) -D__ASSEMBLY__ -o $@ -c $<
|
|
|
|
|
|
|
|
%.d: %.c
|
|
|
|
$(CC) $(CPPFLAGS) -MM -MG -MT "$*.o $@" $< > $@
|
|
|
|
|
|
|
|
%.i: %.c
|
|
|
|
@$(VECHO) CPP $@
|
|
|
|
$(CC) $(CPPFLAGS) -E $< > $@
|
|
|
|
|
|
|
|
%.s: %.c
|
|
|
|
@$(VECHO) CC -S $@
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -S $<
|
|
|
|
|
|
|
|
%.a:
|
|
|
|
@$(VECHO) AR $@
|
|
|
|
$(AR) $(ARFLAGS) $@ $^
|
|
|
|
|
2007-07-07 20:52:25 +02:00
|
|
|
FORCE:
|