comparison Makefile @ 14:f8e628f61f16

Make the config generate gen_config.h with CFG_ and USE() macros. Add distclean. Make clean have double colons so the kconfig makefile's clean matches.
author Rob Landley <rob@landley.net>
date Wed, 01 Nov 2006 22:26:25 -0500
parents fc9c0503d5e2
children 414625f97667
comparison
equal deleted inserted replaced
13:d87d8a056295 14:f8e628f61f16
1 all: 1 # Makefile for toybox.
2 $(CC) -Wall -Os -s $(CFLAGS) -I . main.c toys/*.c lib/*.c -o toybox 2 # Copyright 2006 Rob Landley <rob@landley.net>
3 3
4 clean: 4 CFLAGS = -Wall -Os -s
5 rm toybox 5 CC = $(CROSS_COMPILE)gcc $(CFLAGS)
6 HOST_CC = gcc $(CFLAGS)
7
8 all: toybox
9
10 .PHONY: clean
11
12 include kconfig/Makefile
13
14 # The long and roundabout sed is to make old versions of sed happy. New ones
15 # have '\n' so can replace one line with two without all the branches and
16 # mucking about with hold space.
17 gen_config.h: .config
18 sed -n -e 's/^# CONFIG_\(.*\) is not set.*/\1/' \
19 -e 't notset' -e 'b tryisset' -e ':notset' \
20 -e 'h' -e 's/.*/#define CFG_& 0/p' \
21 -e 'g' -e 's/.*/#define USE_&(...)/p' -e 'd' -e ':tryisset' \
22 -e 's/^CONFIG_\(.*\)=y.*/\1/' -e 't isset' -e 'd' -e ':isset' \
23 -e 'h' -e 's/.*/#define CFG_& 1/p' \
24 -e 'g' -e 's/.*/#define USE_&(...) __VA_ARGS__/p' $< > $@
25
26 # Actual build
27
28 toyfiles = main.c toys/*.c lib/*.c
29 toybox: gen_config.h $(toyfiles)
30 $(CC) -Wall -Os -s -funsigned-char $(CFLAGS) -I . \
31 $(toyfiles) -o toybox
32
33 clean::
34 rm -f toybox gen_config.h
35
36 distclean: clean
37 rm -f .config