1#
2# linux/arch/arm/tools/Makefile
3#
4# Copyright (C) 2001 Russell King
5#
6
7all:	$(TOPDIR)/include/asm-arm/mach-types.h \
8	$(TOPDIR)/include/asm-arm/constants.h
9
10$(TOPDIR)/include/asm-arm/mach-types.h: mach-types gen-mach-types
11	awk -f gen-mach-types mach-types > $@
12
13# Generate the constants.h header file using the compiler.  We get
14# the compiler to spit out assembly code, and then mundge it into
15# what we want.  We do this in several stages so make picks up on
16# any errors that occur along the way.
17
18constants.h: constants-hdr getconstants.c
19	$(CC) $(CFLAGS) -S -o $@.tmp.1 getconstants.c
20	sed 's/^\(#define .* \)[#$$]\(.*\)/\1\2/;/^#define/!d' $@.tmp.1 > $@.tmp.2
21	cat constants-hdr $@.tmp.2 > $@
22	$(RM) $@.tmp*
23
24# Only update include/asm-arm/constants.h when it has actually changed.
25
26$(TOPDIR)/include/asm-arm/constants.h: constants.h
27	cmp constants.h $@ >/dev/null 2>&1 || cp -p constants.h $@
28
29# Build our dependencies, and then generate the constants and
30# mach-types header files.  If we do it now, mkdep will pick
31# the dependencies up later on when it runs through the other
32# directories
33
34dep:
35	$(TOPDIR)/scripts/mkdep $(CFLAGS) $(EXTRA_CFLAGS) -- getconstants.c |\
36	 sed s,getconstants.o,constants.h, > .depend
37	$(MAKE) all
38
39.PHONY:	all dep
40
41ifneq ($(wildcard .depend),)
42include .depend
43endif
44