• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 STRIP
11
12all: toybox
13
14KCONFIG_CONFIG ?= .config
15
16toybox_stuff: $(KCONFIG_CONFIG) *.[ch] lib/*.[ch] 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 root run_root
24
25include kconfig/Makefile
26-include .singlemake
27
28$(KCONFIG_CONFIG): $(KCONFIG_TOP)
29	@if [ -e "$(KCONFIG_CONFIG)" ]; then make silentoldconfig; \
30	else echo "Not configured (run 'make defconfig' or 'make menuconfig')";\
31	exit 1; fi
32
33$(KCONFIG_TOP): generated/Config.in generated/Config.probed
34generated/Config.probed: generated/Config.in
35generated/Config.in: toys/*/*.c scripts/genconfig.sh
36	scripts/genconfig.sh
37
38# Development targets
39baseline: generated/unstripped/toybox
40	@cp generated/unstripped/toybox generated/unstripped/toybox_old
41
42bloatcheck: generated/unstripped/toybox_old generated/unstripped/toybox
43	@scripts/bloatcheck generated/unstripped/toybox_old generated/unstripped/toybox
44
45install_flat:
46	scripts/install.sh --symlink --force
47
48install_airlock:
49	scripts/install.sh --symlink --force --airlock
50
51install:
52	scripts/install.sh --long --symlink --force
53
54uninstall_flat:
55	scripts/install.sh --uninstall
56
57uninstall:
58	scripts/install.sh --long --uninstall
59
60change:
61	scripts/change.sh
62
63root_clean:
64	@rm -rf root
65	@echo root cleaned
66
67clean::
68	@rm -rf toybox generated change .singleconfig* cross-log-*.*
69	@echo cleaned
70
71# If singlemake was in generated/ "make clean; make test_ls" wouldn't work.
72distclean: clean root_clean
73	@rm -f toybox* .config* .singlemake
74	@echo removed .config
75
76tests:
77	scripts/test.sh
78
79root:
80	scripts/mkroot.sh $(MAKEFLAGS)
81
82run_root:
83	C=$$(basename "$$CROSS_COMPILE" | sed 's/-.*//'); \
84        cd root/"$${C:-host}" && ./qemu-*.sh $(MAKEFLAGS) || exit 1
85
86help::
87	@cat scripts/help.txt
88