blob: c36d1cd2649e847255827383f740356ab111ef21 [file] [log] [blame]
Rob Landley401ae8f2006-11-01 22:26:25 -05001# Makefile for toybox.
2# Copyright 2006 Rob Landley <rob@landley.net>
landleyc5621502006-09-28 17:18:51 -04003
Rob Landley5b39d5c2015-10-04 08:44:17 -05004# 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".
Rob Landley12235782015-10-05 20:47:49 -05007
8HOSTCC?=cc
9
Rob Landley5b39d5c2015-10-04 08:44:17 -050010export CROSS_COMPILE CFLAGS OPTIMIZE LDOPTIMIZE CC HOSTCC V
11
Rob Landley401ae8f2006-11-01 22:26:25 -050012all: toybox
13
Rob Landleyd04dc1f2013-08-30 01:53:31 -050014KCONFIG_CONFIG ?= .config
Rob Landley62390fd2014-11-28 16:49:46 -060015
16toybox_stuff: $(KCONFIG_CONFIG) *.[ch] lib/*.[ch] toys/*.h toys/*/*.c scripts/*.sh
17
Rob Landleya8d0d132016-03-23 03:25:37 -050018toybox generated/unstripped/toybox: toybox_stuff
Rob Landley28964802008-01-19 17:08:39 -060019 scripts/make.sh
20
Rob Landleybf081b92008-03-28 00:40:57 -050021.PHONY: clean distclean baseline bloatcheck install install_flat \
Rob Landleya8d0d132016-03-23 03:25:37 -050022 uinstall uninstall_flat tests help toybox_stuff change \
Rob Landley05b75292016-02-14 14:04:21 -060023 list list_working list_pending
Rob Landley401ae8f2006-11-01 22:26:25 -050024
25include kconfig/Makefile
Rob Landley712e43e2016-02-07 18:15:53 -060026-include .singlemake
Rob Landley401ae8f2006-11-01 22:26:25 -050027
Rob Landley62390fd2014-11-28 16:49:46 -060028$(KCONFIG_CONFIG): $(KCONFIG_TOP)
Rob Landley28964802008-01-19 17:08:39 -060029$(KCONFIG_TOP): generated/Config.in
Rob Landley3a9241a2012-08-25 14:25:22 -050030generated/Config.in: toys/*/*.c scripts/genconfig.sh
Rob Landley28964802008-01-19 17:08:39 -060031 scripts/genconfig.sh
Rob Landleyde05a702007-01-31 14:37:01 -050032
Rob Landleycd2edfd2006-11-26 18:47:14 -050033# Development targets
Rob Landleya8d0d132016-03-23 03:25:37 -050034baseline: generated/unstripped/toybox
35 @cp generated/unstripped/toybox generated/unstripped/toybox_old
Rob Landleycd2edfd2006-11-26 18:47:14 -050036
Rob Landleya8d0d132016-03-23 03:25:37 -050037bloatcheck: toybox_old generated/unstripped/toybox
38 @scripts/bloatcheck generated/unstripped/toybox_old generated/unstripped/toybox
Rob Landleycd2edfd2006-11-26 18:47:14 -050039
Rob Landley9a64b8d2016-02-03 22:33:04 -060040install_flat:
Rob Landley05fbd1e2008-03-28 00:09:31 -050041 scripts/install.sh --symlink --force
42
Rob Landley6c3188c2016-10-02 22:41:55 -050043install_airlock:
44 scripts/install.sh --symlink --force --airlock
45
Rob Landley05fbd1e2008-03-28 00:09:31 -050046install:
47 scripts/install.sh --long --symlink --force
Rob Landleybcfad872007-01-31 14:18:05 -050048
Rob Landleydf07fb72016-02-10 23:27:55 -060049uninstall_flat:
Rob Landleybf081b92008-03-28 00:40:57 -050050 scripts/install.sh --uninstall
51
52uninstall:
53 scripts/install.sh --long --uninstall
54
Rob Landley5eb44752015-02-07 17:19:38 -060055change:
Rob Landley45962a72015-02-14 01:08:15 -060056 scripts/change.sh
Rob Landley62390fd2014-11-28 16:49:46 -060057
Rob Landley401ae8f2006-11-01 22:26:25 -050058clean::
Rob Landleya8d0d132016-03-23 03:25:37 -050059 rm -rf toybox generated change .singleconfig*
Rob Landley401ae8f2006-11-01 22:26:25 -050060
Rob Landley8cc325d2016-09-04 18:07:12 -050061# If singlemake was in generated/ "make clean; make test_ls" wouldn't work.
Rob Landley401ae8f2006-11-01 22:26:25 -050062distclean: clean
Rob Landley712e43e2016-02-07 18:15:53 -060063 rm -f toybox_old .config* .singlemake
Rob Landleycd2edfd2006-11-26 18:47:14 -050064
Rob Landleye35f2b82007-06-18 01:09:00 -040065tests:
Rob Landley9d243a22008-03-28 00:44:44 -050066 scripts/test.sh
Rob Landleye35f2b82007-06-18 01:09:00 -040067
Rob Landleycd2edfd2006-11-26 18:47:14 -050068help::
Rob Landley28964802008-01-19 17:08:39 -060069 @echo ' toybox - Build toybox.'
Rob Landley712e43e2016-02-07 18:15:53 -060070 @echo ' COMMANDNAME - Build individual toybox command as a standalone binary.'
Rob Landleya5995142016-04-20 00:47:05 -050071 @echo ' list - List COMMANDNAMEs you can build standalone.'
72 @echo ' list_pending - List unfinished COMMANDNAMEs out of toys/pending.'
Rob Landleye72ea202014-12-13 11:59:10 -060073 @echo ' change - Build each command standalone under change/.'
Elliott Hughes58e06422015-03-28 13:13:42 -050074 @echo ' baseline - Create toybox_old for use by bloatcheck.'
Rob Landleycd2edfd2006-11-26 18:47:14 -050075 @echo ' bloatcheck - Report size differences between old and current versions'
Elliott Hughesd3904ef2016-02-27 13:27:26 -080076 @echo ' test_COMMAND - Run tests for COMMAND (test_ps, test_cat, etc.)'
Rob Landleya8d0d132016-03-23 03:25:37 -050077 @echo ' tests - Run test suite against all compiled commands.'
Rob Landley5ec9f522016-02-19 17:56:01 -060078 @echo ' export TEST_HOST=1 to test host command, VERBOSE=1'
79 @echo ' to show diff, VERBOSE=fail to stop after first failure.'
Rob Landley28964802008-01-19 17:08:39 -060080 @echo ' clean - Delete temporary files.'
Rob Landleye614ee12011-12-28 16:17:13 -060081 @echo " distclean - Delete everything that isn't shipped."
Rob Landleycba5dc42017-01-04 14:18:12 -060082 @echo ' install_airlock - Install toybox and host toolchain into $$PREFIX directory'
83 @echo ' (providing $$PATH for hermetic builds).'
Rob Landleye614ee12011-12-28 16:17:13 -060084 @echo ' install_flat - Install toybox into $$PREFIX directory.'
85 @echo ' install - Install toybox into subdirectories of $$PREFIX.'
86 @echo ' uninstall_flat - Remove toybox from $$PREFIX directory.'
87 @echo ' uninstall - Remove toybox from subdirectories of $$PREFIX.'
Rob Landley09e8bde2012-02-04 12:20:39 -060088 @echo ''
89 @echo 'example: CFLAGS="--static" CROSS_COMPILE=armv5l- make defconfig toybox install'
90 @echo ''