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@freescale.com>
The definition of LIBFDT_INCLUDES was accidentally dropped.
Put it back and add srcdir prefix handling for it.
Signed-off-by: Jon Loeliger <jdl@freescale.com>
Enabling -Wcast-qual warnings in dtc shows up a number of places where
we are incorrectly discarding a const qualification. There are also
some places where we are intentionally discarding the 'const', and we
need an ugly cast through uintptr_t to suppress the warning. However,
most of these are pretty well isolated with the *_w() functions. So
in the interests of maximum safety with const qualifications, this
patch enables the warnings and fixes the existing complaints.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This patch turns on the -Wpointer-arith option in the dtc Makefile,
and fixes the resulting warnings due to using (void *) in pointer
arithmetic. While convenient, pointer arithmetic on void * is not
portable, so it's better that we avoid it, particularly in libfdt.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Previous cleanups have removed the LIBFDT_CLEANFILES and
DTC_CLEANFILES variables from the Makefiles. However, they're still
referenced by the Makefile. This patch gets rid of these last
vestiges.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This patch adds a new utility program, convert-dtsv0, to the dtc
sources. This program will convert dts files from v0 to v1,
preserving comments and spacing. It also includes some heuristics to
guess an appropriate base to use in the v1 output (so it will use hex
for the contents of reg properties and decimal for clock-frequency
properties, for example). They're limited and imperfect, but not
terrible.
The guts of the converter program is a modified version of the lexer
from dtc itself.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Currently the Makefile.dtc and Makefile.libfdt fragments include a
number of things that seemed like they might be useful for other
projects embedding the pieces, or for a make dist target.
Well, we have no make dist target, it's become fairly unclear that
these things would actually be useful to embedders (the kernel
certainly doesn't use them), and it's a bunch of stuff with no current
users.
This patch, therefore, removes a bunch of unused definitions from the
Makefile fragments. It also removes a dependency declared in
Makefile.libfdt (of libfdt.a on the constituent .o files) which was
incorrect (wrong path), and if corrected would be redundant with the
similar dependency in the top-level makefile.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Currently "make all" for dtc will build (but not run) the testcase
binaries. This is a problem for cross compiles, because building the
tests will attempt to run the dumptrees utility on the host system,
which won't work if it's cross-compiled of course.
Although it would be possible to separately build host binaries,
there's not a lot of value in doing so since we don't have a facility
for cross-executing the testsuite anyway.
Therefore, remove the tests from the "all" target. It will still, of
course, be build as a prerequisite to "make check" which will run the
testsuite.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Author: Geoff Levand <geoffrey.levand@am.sony.com>
Apparently some versions of flex don't correctly parse the -o
parameter, if there's a space between the -o and its argument. So,
this patch removes it.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
At present, the Makefiles will not rebuild trees.o or the dtb files
derived from it if testdata.h is updated. This is incorrect, and is
because of missing dependency information.
This patch fixes the problem by making sure that dependency
information is generated from trees.S and dumptrees.c.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
/usr/bin/install: cannot stat `fdt.h': No such file or directory
/usr/bin/install: cannot stat `libfdt.h': No such file or directory
Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Remove the uneccessary LDFLAGS from the top-level makefile. It only
added libfdt/ to the link path. dtc doesn't need libfdt at all, and
the testcases which do, already link libfdt.a by explicit path.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Previously, there were a few shift/reduce and reduce/reduce
errors in the grammar that were being handled by the not-so-popular
GLR Parser technique.
Flip a right-recursive stack-abusing rule into a left-recursive
stack-friendly rule and clear up three messes in one shot: No more
conflicts, no need for the GLR parser, and friendlier stackness.
Compensate by reversing the property list on the node.
Signed-off-by: Jon Loeliger <jdl@freescale.com>
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>
This large patch removes all trailing whitespace from dtc (including
libfdt, the testsuite and documentation). It also removes a handful
of redundant blank lines (at the end of functions, or when there are
two blank lines together for no particular reason).
As well as anything else, this means that quilt won't whinge when I go
to convert the whole of libfdt into a patch to apply to the kernel.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This patch turns on optimisation in the Makefile by default. With the
optimizer on, some uninitialized variable warnings (one real, two
bogus) are now generated. This patch also squashes those again.
Currently, dtc relies on make's implicit rule to build the testcases.
This means that when not making verbosely (V=0, the default) there is
no message at all while relinking the testsuites. This can be very
confusing when updating libfdt.a (upon which the testcases depend) and
make appears to do nothing.
This patch corrects the situation, borrowing the rule used to link dtc
itself to link all the testcases as well.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
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>
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.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Keeps track of open files in a stack, and assigns
a filenum to source positions for each lexical token.
Modified error reporting to show source file as well.
No policy on file directory basis has been decided.
Still handles stdin.
Tested on all arch/powerpc/boot/dts DTS files
Signed-off-by: Jon Loeliger <jdl@freescale.com>
libdt.c was an attempt at creating a device tree handling library
within the dtc codebase. However, it was never even close to
completion, and is entirely obsoleted by it's spiritual descendent,
libfdt (currently a separate package). This patch, therefore, removes
libdt.c entirely, along with its only reference in the Makefile, an
unused variable.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This function moves the fdt_strerror() function, currently found in
the test code into the fdt library proper. This makes life easier for
any library users who want to provide meaningful error messages. The
function goes into a module of its own, so that users who don't need
the function won't get a copy of it linked in.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>