Makefile revision 5b39d5c58cc3c43580a9114355b0763c171926b6
1# Makefile for toybox.
2# Copyright 2006 Rob Landley <rob@landley.net>
3
4# If people set these on the make command line, use 'em
5# Note that CC defaults to "cc" so the one in configure doesn't get
6# used when scripts/make.sh and care called through "make".
7export CROSS_COMPILE CFLAGS OPTIMIZE LDOPTIMIZE CC HOSTCC V
8
9all: toybox
10
11KCONFIG_CONFIG ?= .config
12
13toybox_stuff: $(KCONFIG_CONFIG) *.[ch] lib/*.[ch] toys/*.h toys/*/*.c scripts/*.sh
14
15toybox toybox_unstripped: toybox_stuff
16	scripts/make.sh
17
18.PHONY: clean distclean baseline bloatcheck install install_flat \
19	uinstall uninstall_flat test tests help toybox_stuff change
20
21include kconfig/Makefile
22
23$(KCONFIG_CONFIG): $(KCONFIG_TOP)
24$(KCONFIG_TOP): generated/Config.in
25generated/Config.in: toys/*/*.c scripts/genconfig.sh
26	scripts/genconfig.sh
27
28HOSTCC?=cc
29
30# Development targets
31baseline: toybox_unstripped
32	@cp toybox_unstripped toybox_old
33
34bloatcheck: toybox_old toybox_unstripped
35	@scripts/bloatcheck toybox_old toybox_unstripped
36
37generated/instlist: toybox_stuff
38	NOBUILD=1 scripts/make.sh
39	$(HOSTCC) -I . scripts/install.c -o generated/instlist
40
41install_flat: generated/instlist
42	scripts/install.sh --symlink --force
43
44install:
45	scripts/install.sh --long --symlink --force
46
47uninstall_flat: generated/instlist
48	scripts/install.sh --uninstall
49
50uninstall:
51	scripts/install.sh --long --uninstall
52
53change:
54	scripts/change.sh
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  '  change          - Build each command standalone under change/.'
70	@echo  '  baseline        - Create toybox_old for use by bloatcheck.'
71	@echo  '  bloatcheck      - Report size differences between old and current versions'
72	@echo  '  test            - Run test suite against compiled commands.'
73	@echo  '  clean           - Delete temporary files.'
74	@echo  "  distclean       - Delete everything that isn't shipped."
75	@echo  '  install_flat    - Install toybox into $$PREFIX directory.'
76	@echo  '  install         - Install toybox into subdirectories of $$PREFIX.'
77	@echo  '  uninstall_flat  - Remove toybox from $$PREFIX directory.'
78	@echo  '  uninstall       - Remove toybox from subdirectories of $$PREFIX.'
79	@echo  ''
80	@echo  'example: CFLAGS="--static" CROSS_COMPILE=armv5l- make defconfig toybox install'
81	@echo  ''
82