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".
7
8HOSTCC?=cc
9
10export CROSS_COMPILE CFLAGS OPTIMIZE LDOPTIMIZE CC HOSTCC V
11
12all: toybox
13
14KCONFIG_CONFIG ?= .config
15
16toybox_stuff: $(KCONFIG_CONFIG) *.[ch] lib/*.[ch] toys/*.h toys/*/*.c scripts/*.sh
17
18toybox generated/unstripped/toybox: toybox_stuff
19	scripts/make.sh
20
21.PHONY: clean distclean baseline bloatcheck install install_flat \
22	uinstall uninstall_flat tests help toybox_stuff change \
23	list list_working list_pending
24
25include kconfig/Makefile
26-include .singlemake
27
28$(KCONFIG_CONFIG): $(KCONFIG_TOP)
29$(KCONFIG_TOP): generated/Config.in
30generated/Config.in: toys/*/*.c scripts/genconfig.sh
31	scripts/genconfig.sh
32
33# Development targets
34baseline: generated/unstripped/toybox
35	@cp generated/unstripped/toybox generated/unstripped/toybox_old
36
37bloatcheck: generated/unstripped/toybox_old generated/unstripped/toybox
38	@scripts/bloatcheck generated/unstripped/toybox_old generated/unstripped/toybox
39
40install_flat:
41	scripts/install.sh --symlink --force
42
43install_airlock:
44	scripts/install.sh --symlink --force --airlock
45
46install:
47	scripts/install.sh --long --symlink --force
48
49uninstall_flat:
50	scripts/install.sh --uninstall
51
52uninstall:
53	scripts/install.sh --long --uninstall
54
55change:
56	scripts/change.sh
57
58clean::
59	rm -rf toybox generated change .singleconfig*
60
61# If singlemake was in generated/ "make clean; make test_ls" wouldn't work.
62distclean: clean
63	rm -f toybox_old .config* .singlemake
64
65tests:
66	scripts/test.sh
67
68help::
69	@cat scripts/help.txt
70