• 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
11
12all: toybox
13
14KCONFIG_CONFIG ?= .config
15
16toybox_stuff: $(KCONFIG_CONFIG) *.[ch] lib/*.[ch] toys/*.h toys/*/*.c scripts/*.sh
17
18toybox toybox_unstripped: toybox_stuff
19	scripts/make.sh
20
21.PHONY: clean distclean baseline bloatcheck install install_flat \
22	uinstall uninstall_flat test 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: toybox_unstripped
35	@cp toybox_unstripped toybox_old
36
37bloatcheck: toybox_old toybox_unstripped
38	@scripts/bloatcheck toybox_old toybox_unstripped
39
40install_flat:
41	scripts/install.sh --symlink --force
42
43install:
44	scripts/install.sh --long --symlink --force
45
46uninstall_flat:
47	scripts/install.sh --uninstall
48
49uninstall:
50	scripts/install.sh --long --uninstall
51
52change:
53	scripts/change.sh
54
55clean::
56	rm -rf toybox toybox_unstripped generated change .singleconfig*
57
58distclean: clean
59	rm -f toybox_old .config* .singlemake
60
61test: tests
62
63tests:
64	scripts/test.sh
65
66help::
67	@echo  '  toybox          - Build toybox.'
68	@echo  '  COMMANDNAME     - Build individual toybox command as a standalone binary.'
69	@echo  '  list            - List COMMANDNAMEs (also list_working and list_pending).'
70	@echo  '  change          - Build each command standalone under change/.'
71	@echo  '  baseline        - Create toybox_old for use by bloatcheck.'
72	@echo  '  bloatcheck      - Report size differences between old and current versions'
73	@echo  '  test_COMMAND    - Run tests for COMMAND (test_ps, test_cat, etc.)
74	@echo  '  test            - Run test suite against all compiled commands.'
75	@echo  '                    export TEST_HOST=1 to test host command, VERBOSE=1'
76	@echo  '                    to show diff, VERBOSE=fail to stop after first failure.'
77	@echo  '  clean           - Delete temporary files.'
78	@echo  "  distclean       - Delete everything that isn't shipped."
79	@echo  '  install_flat    - Install toybox into $$PREFIX directory.'
80	@echo  '  install         - Install toybox into subdirectories of $$PREFIX.'
81	@echo  '  uninstall_flat  - Remove toybox from $$PREFIX directory.'
82	@echo  '  uninstall       - Remove toybox from subdirectories of $$PREFIX.'
83	@echo  ''
84	@echo  'example: CFLAGS="--static" CROSS_COMPILE=armv5l- make defconfig toybox install'
85	@echo  ''
86