blob: 1ea69295c157c8deb0946e94a2b7d2bee2677962 [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 Landley401ae8f2006-11-01 22:26:25 -05004all: toybox
5
Rob Landleyd04dc1f2013-08-30 01:53:31 -05006KCONFIG_CONFIG ?= .config
Rob Landley62390fd2014-11-28 16:49:46 -06007
8toybox_stuff: $(KCONFIG_CONFIG) *.[ch] lib/*.[ch] toys/*.h toys/*/*.c scripts/*.sh
9
10toybox toybox_unstripped: toybox_stuff
Rob Landley28964802008-01-19 17:08:39 -060011 scripts/make.sh
12
Rob Landleybf081b92008-03-28 00:40:57 -050013.PHONY: clean distclean baseline bloatcheck install install_flat \
Rob Landley45962a72015-02-14 01:08:15 -060014 uinstall uninstall_flat test tests help toybox_stuff change
Rob Landley401ae8f2006-11-01 22:26:25 -050015
16include kconfig/Makefile
17
Rob Landley62390fd2014-11-28 16:49:46 -060018$(KCONFIG_CONFIG): $(KCONFIG_TOP)
Rob Landley28964802008-01-19 17:08:39 -060019$(KCONFIG_TOP): generated/Config.in
Rob Landley3a9241a2012-08-25 14:25:22 -050020generated/Config.in: toys/*/*.c scripts/genconfig.sh
Rob Landley28964802008-01-19 17:08:39 -060021 scripts/genconfig.sh
Rob Landleyde05a702007-01-31 14:37:01 -050022
Rob Landleyfcf188f2012-02-19 22:21:45 -060023HOSTCC?=cc
Rob Landley401ae8f2006-11-01 22:26:25 -050024
Rob Landleycd2edfd2006-11-26 18:47:14 -050025# Development targets
26baseline: toybox_unstripped
27 @cp toybox_unstripped toybox_old
28
29bloatcheck: toybox_old toybox_unstripped
Rob Landley7a4551f2012-02-21 21:27:10 -060030 @scripts/bloatcheck toybox_old toybox_unstripped
Rob Landleycd2edfd2006-11-26 18:47:14 -050031
Rob Landley62390fd2014-11-28 16:49:46 -060032generated/instlist: toybox_stuff
33 NOBUILD=1 scripts/make.sh
Rob Landley207cada2013-10-03 03:18:00 -050034 $(HOSTCC) -I . scripts/install.c -o generated/instlist
Rob Landleybcfad872007-01-31 14:18:05 -050035
Rob Landley207cada2013-10-03 03:18:00 -050036install_flat: generated/instlist
Rob Landley05fbd1e2008-03-28 00:09:31 -050037 scripts/install.sh --symlink --force
38
39install:
40 scripts/install.sh --long --symlink --force
Rob Landleybcfad872007-01-31 14:18:05 -050041
Rob Landley207cada2013-10-03 03:18:00 -050042uninstall_flat: generated/instlist
Rob Landleybf081b92008-03-28 00:40:57 -050043 scripts/install.sh --uninstall
44
45uninstall:
46 scripts/install.sh --long --uninstall
47
Rob Landley5eb44752015-02-07 17:19:38 -060048change:
Rob Landley45962a72015-02-14 01:08:15 -060049 scripts/change.sh
Rob Landley62390fd2014-11-28 16:49:46 -060050
Rob Landley401ae8f2006-11-01 22:26:25 -050051clean::
Rob Landley6d33f3a2014-11-28 16:51:32 -060052 rm -rf toybox toybox_unstripped generated change .singleconfig*
Rob Landley401ae8f2006-11-01 22:26:25 -050053
54distclean: clean
Rob Landley86cafe12014-01-03 18:23:09 -060055 rm -f toybox_old .config*
Rob Landleycd2edfd2006-11-26 18:47:14 -050056
Rob Landleye35f2b82007-06-18 01:09:00 -040057test: tests
58
59tests:
Rob Landley9d243a22008-03-28 00:44:44 -050060 scripts/test.sh
Rob Landleye35f2b82007-06-18 01:09:00 -040061
Rob Landleycd2edfd2006-11-26 18:47:14 -050062help::
Rob Landley28964802008-01-19 17:08:39 -060063 @echo ' toybox - Build toybox.'
Rob Landleye72ea202014-12-13 11:59:10 -060064 @echo ' change - Build each command standalone under change/.'
Elliott Hughes58e06422015-03-28 13:13:42 -050065 @echo ' baseline - Create toybox_old for use by bloatcheck.'
Rob Landleycd2edfd2006-11-26 18:47:14 -050066 @echo ' bloatcheck - Report size differences between old and current versions'
Rob Landley28964802008-01-19 17:08:39 -060067 @echo ' test - Run test suite against compiled commands.'
68 @echo ' clean - Delete temporary files.'
Rob Landleye614ee12011-12-28 16:17:13 -060069 @echo " distclean - Delete everything that isn't shipped."
70 @echo ' install_flat - Install toybox into $$PREFIX directory.'
71 @echo ' install - Install toybox into subdirectories of $$PREFIX.'
72 @echo ' uninstall_flat - Remove toybox from $$PREFIX directory.'
73 @echo ' uninstall - Remove toybox from subdirectories of $$PREFIX.'
Rob Landley09e8bde2012-02-04 12:20:39 -060074 @echo ''
75 @echo 'example: CFLAGS="--static" CROSS_COMPILE=armv5l- make defconfig toybox install'
76 @echo ''