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 such 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 generated/unstripped/toybox: $(KCONFIG_CONFIG) *.[ch] lib/*.[ch] toys/*/*.c scripts/*.sh Config.in 17 scripts/make.sh 18 19.PHONY: clean distclean baseline bloatcheck install install_flat \ 20 uninstall uninstall_flat tests help change \ 21 list list_example list_pending root run_root 22.SUFFIXES: # Disable legacy behavior 23 24include kconfig/Makefile 25-include .singlemake 26 27$(KCONFIG_CONFIG): $(KCONFIG_TOP) 28 @if [ -e "$(KCONFIG_CONFIG)" ]; then make silentoldconfig; \ 29 else echo "Not configured (run 'make defconfig' or 'make menuconfig')";\ 30 exit 1; fi 31 32$(KCONFIG_TOP): generated/Config.in generated/Config.probed 33generated/Config.probed: generated/Config.in 34generated/Config.in: toys/*/*.c scripts/genconfig.sh 35 scripts/genconfig.sh 36 37# Development targets 38baseline: generated/unstripped/toybox 39 @cp generated/unstripped/toybox generated/unstripped/toybox_old 40 41bloatcheck: generated/unstripped/toybox_old generated/unstripped/toybox 42 @scripts/bloatcheck generated/unstripped/toybox_old generated/unstripped/toybox 43 44install_flat: toybox 45 scripts/install.sh --symlink --force 46 47install_airlock: toybox 48 scripts/install.sh --symlink --force --airlock 49 50install: toybox 51 scripts/install.sh --long --symlink --force 52 53uninstall_flat: 54 scripts/install.sh --uninstall 55 56uninstall: 57 scripts/install.sh --long --uninstall 58 59change: 60 scripts/change.sh 61 62root_clean: 63 @rm -rf root 64 @echo root cleaned 65 66clean:: 67 @chmod -fR 700 generated || true 68 @rm -rf toybox generated change install .singleconfig* 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: toybox 77 scripts/test.sh 78 79root: 80 scripts/mkroot.sh $(MAKEFLAGS) 81 82run_root: 83 cd root/"$${CROSS:-host}" && ./run-qemu.sh 84 85help:: 86 @cat scripts/help.txt 87