Makefile revision 6d33f3a8be75aadfc9fd452ed67964920e451b14
1# Makefile for toybox.
2# Copyright 2006 Rob Landley <rob@landley.net>
3
4all: toybox
5
6KCONFIG_CONFIG ?= .config
7
8toybox_stuff: $(KCONFIG_CONFIG) *.[ch] lib/*.[ch] toys/*.h toys/*/*.c scripts/*.sh
9
10toybox toybox_unstripped: toybox_stuff
11	scripts/make.sh
12
13.PHONY: clean distclean baseline bloatcheck install install_flat \
14	uinstall uninstall_flat test tests help toybox_stuff
15
16include kconfig/Makefile
17
18$(KCONFIG_CONFIG): $(KCONFIG_TOP)
19$(KCONFIG_TOP): generated/Config.in
20generated/Config.in: toys/*/*.c scripts/genconfig.sh
21	scripts/genconfig.sh
22
23HOSTCC?=cc
24
25# Development targets
26baseline: toybox_unstripped
27	@cp toybox_unstripped toybox_old
28
29bloatcheck: toybox_old toybox_unstripped
30	@scripts/bloatcheck toybox_old toybox_unstripped
31
32generated/instlist: toybox_stuff
33	NOBUILD=1 scripts/make.sh
34	$(HOSTCC) -I . scripts/install.c -o generated/instlist
35
36install_flat: generated/instlist
37	scripts/install.sh --symlink --force
38
39install:
40	scripts/install.sh --long --symlink --force
41
42uninstall_flat: generated/instlist
43	scripts/install.sh --uninstall
44
45uninstall:
46	scripts/install.sh --long --uninstall
47
48change: generated/instlist
49	export PREFIX=$${PREFIX:-change/} && \
50	mkdir -p "$$PREFIX" && \
51	for i in $$(generated/instlist); \
52		do echo make $$i && \
53		scripts/single.sh $$i || touch $$PREFIX/$${i}.bad; \
54	done
55
56clean::
57	rm -rf toybox toybox_unstripped generated change .singleconfig*
58
59distclean: clean
60	rm -f toybox_old .config*
61
62test: tests
63
64tests:
65	scripts/test.sh
66
67help::
68	@echo  '  toybox          - Build toybox.'
69	@echo  '  baseline        - Create busybox_old for use by bloatcheck.'
70	@echo  '  bloatcheck      - Report size differences between old and current versions'
71	@echo  '  test            - Run test suite against compiled commands.'
72	@echo  '  clean           - Delete temporary files.'
73	@echo  "  distclean       - Delete everything that isn't shipped."
74	@echo  '  install_flat    - Install toybox into $$PREFIX directory.'
75	@echo  '  install         - Install toybox into subdirectories of $$PREFIX.'
76	@echo  '  uninstall_flat  - Remove toybox from $$PREFIX directory.'
77	@echo  '  uninstall       - Remove toybox from subdirectories of $$PREFIX.'
78	@echo  ''
79	@echo  'example: CFLAGS="--static" CROSS_COMPILE=armv5l- make defconfig toybox install'
80	@echo  ''
81