comparison Makefile @ 232:cd4d5630c978

Move some generated files into the "generated" subdirectory.
author Rob Landley <rob@landley.net>
date Thu, 10 Jan 2008 14:40:13 -0600
parents e83f92dc44a0
children d4176f3f3835
comparison
equal deleted inserted replaced
231:31dc682c18ad 232:cd4d5630c978
24 .config: Config.in toys/Config.in 24 .config: Config.in toys/Config.in
25 25
26 # The long and roundabout sed is to make old versions of sed happy. New ones 26 # The long and roundabout sed is to make old versions of sed happy. New ones
27 # have '\n' so can replace one line with two without all the branches and 27 # have '\n' so can replace one line with two without all the branches and
28 # mucking about with hold space. 28 # mucking about with hold space.
29 gen_config.h: .config 29 generated/gen_config.h: .config
30 sed -n -e 's/^# CONFIG_\(.*\) is not set.*/\1/' \ 30 sed -n -e 's/^# CONFIG_\(.*\) is not set.*/\1/' \
31 -e 't notset' -e 'b tryisset' -e ':notset' \ 31 -e 't notset' -e 'b tryisset' -e ':notset' \
32 -e 'h' -e 's/.*/#define CFG_& 0/p' \ 32 -e 'h' -e 's/.*/#define CFG_& 0/p' \
33 -e 'g' -e 's/.*/#define USE_&(...)/p' -e 'd' -e ':tryisset' \ 33 -e 'g' -e 's/.*/#define USE_&(...)/p' -e 'd' -e ':tryisset' \
34 -e 's/^CONFIG_\(.*\)=y.*/\1/' -e 't isset' -e 'd' -e ':isset' \ 34 -e 's/^CONFIG_\(.*\)=y.*/\1/' -e 't isset' -e 'd' -e ':isset' \
44 44
45 # Get list of .c files to compile, including toys/*.c files from .config 45 # Get list of .c files to compile, including toys/*.c files from .config
46 toyfiles = main.c lib/*.c \ 46 toyfiles = main.c lib/*.c \
47 $(shell scripts/cfg2files.sh < .config | sed 's@\(.*\)@toys/\1.c@') 47 $(shell scripts/cfg2files.sh < .config | sed 's@\(.*\)@toys/\1.c@')
48 48
49 # The following still depends on toys/help.h even when it's not there, so *.h 49 # The following still depends on generated/help.h even when it's not there, so
50 # isn't sufficient by itself. 50 # *.h isn't sufficient by itself.
51 51
52 toybox_unstripped: gen_config.h $(toyfiles) toys/toylist.h toys/help.h toys/*.h lib/*.h toys.h 52 toybox_unstripped: generated/gen_config.h generated/help.h $(toyfiles) toys/toylist.h toys/*.h lib/*.h toys.h
53 $(CC) $(CCFLAGS) -I . $(toyfiles) -o toybox_unstripped $(OPTIMIZE) 53 $(CC) $(CCFLAGS) -I . $(toyfiles) -o toybox_unstripped $(OPTIMIZE)
54 54
55 toybox: toybox_unstripped 55 toybox: toybox_unstripped
56 $(STRIP) toybox_unstripped -o toybox 56 $(STRIP) toybox_unstripped -o toybox
57 57
58 toys/help.c: toys/help.h 58 toys/help.c: generated/help.h
59 59
60 toys/help.h: Config.in toys/Config.in scripts/config2help.py 60 generated/help.h: Config.in toys/Config.in scripts/config2help.py
61 scripts/config2help.py Config.in > toys/help.h 61 scripts/config2help.py Config.in > generated/help.h
62 62
63 instlist: toybox 63 instlist: toybox
64 $(HOSTCC) $(CCFLAGS) -I . scripts/install.c -o instlist 64 $(HOSTCC) $(CCFLAGS) -I . scripts/install.c -o instlist
65 65
66 install_flat: instlist 66 install_flat: instlist
67 @mkdir -p $(PREFIX)/ 67 @mkdir -p $(PREFIX)/
68 @cp toybox $(PREFIX)/ 68 @cp toybox $(PREFIX)/
69 @for i in `./instlist`; do ln -s toybox "$(PREFIX)/$$i"; done 69 @for i in `./instlist`; do ln -s toybox "$(PREFIX)/$$i"; done
70 70
71 clean:: 71 clean::
72 rm -f toybox toybox_unstripped gen_config.h instlist 72 rm -f toybox toybox_unstripped generated/gen_config.h instlist
73 73
74 distclean: clean 74 distclean: clean
75 rm -f toybox_old .config* toys/help.h 75 rm -f toybox_old .config* generated/help.h
76 76
77 test: tests 77 test: tests
78 78
79 tests: 79 tests:
80 scripts/testall.sh 80 scripts/testall.sh