X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=Makefile;h=c36d1cd2649e847255827383f740356ab111ef21;hb=bc308973ffb671084328da6e20f146cba1454466;hp=86ed635dc02fd8bc545634b1aeebe186df3078c1;hpb=064d1b1e5d29f79060c47769da92d51f89bc9edd;p=android-x86%2Fexternal-toybox.git diff --git a/Makefile b/Makefile index 86ed635d..c36d1cd2 100644 --- a/Makefile +++ b/Makefile @@ -1,81 +1,90 @@ # Makefile for toybox. # Copyright 2006 Rob Landley -CFLAGS := $(CFLAGS) -Wall -Wundef -Wno-char-subscripts -CCFLAGS = $(CFLAGS) -funsigned-char -OPTIMIZE = -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -CC = $(CROSS_COMPILE)gcc -STRIP = $(CROSS_COMPILE)strip -HOSTCC = gcc +# If people set these on the make command line, use 'em +# Note that CC defaults to "cc" so the one in configure doesn't get +# used when scripts/make.sh and care called through "make". -# A synonym. -CROSS_COMPILE = $(CROSS) +HOSTCC?=cc + +export CROSS_COMPILE CFLAGS OPTIMIZE LDOPTIMIZE CC HOSTCC V all: toybox -.PHONY: clean +KCONFIG_CONFIG ?= .config -include kconfig/Makefile +toybox_stuff: $(KCONFIG_CONFIG) *.[ch] lib/*.[ch] toys/*.h toys/*/*.c scripts/*.sh + +toybox generated/unstripped/toybox: toybox_stuff + scripts/make.sh -# defconfig is the "maximum sane config"; allyesconfig minus debugging and such. -#defconfig: allyesconfig -# @sed -i -r -e "s/^(CONFIG_TOYBOX_(DEBUG|FREE))=.*/# \1 is not set/" .config +.PHONY: clean distclean baseline bloatcheck install install_flat \ + uinstall uninstall_flat tests help toybox_stuff change \ + list list_working list_pending -.config: Config.in toys/Config.in +include kconfig/Makefile +-include .singlemake -# The long and roundabout sed is to make old versions of sed happy. New ones -# have '\n' so can replace one line with two without all the branches and -# mucking about with hold space. -gen_config.h: .config - sed -n -e 's/^# CONFIG_\(.*\) is not set.*/\1/' \ - -e 't notset' -e 'b tryisset' -e ':notset' \ - -e 'h' -e 's/.*/#define CFG_& 0/p' \ - -e 'g' -e 's/.*/#define USE_&(...)/p' -e 'd' -e ':tryisset' \ - -e 's/^CONFIG_\(.*\)=y.*/\1/' -e 't isset' -e 'd' -e ':isset' \ - -e 'h' -e 's/.*/#define CFG_& 1/p' \ - -e 'g' -e 's/.*/#define USE_&(...) __VA_ARGS__/p' $< > $@ +$(KCONFIG_CONFIG): $(KCONFIG_TOP) +$(KCONFIG_TOP): generated/Config.in +generated/Config.in: toys/*/*.c scripts/genconfig.sh + scripts/genconfig.sh # Development targets -baseline: toybox_unstripped - @cp toybox_unstripped toybox_old - -bloatcheck: toybox_old toybox_unstripped - @scripts/bloat-o-meter toybox_old toybox_unstripped +baseline: generated/unstripped/toybox + @cp generated/unstripped/toybox generated/unstripped/toybox_old -# Get list of .c files to compile, including toys/*.c files from .config -toyfiles = main.c lib/*.c \ - $(shell scripts/cfg2files.sh < .config | sed 's@\(.*\)@toys/\1.c@') +bloatcheck: toybox_old generated/unstripped/toybox + @scripts/bloatcheck generated/unstripped/toybox_old generated/unstripped/toybox -toybox_unstripped: gen_config.h $(toyfiles) toys/toylist.h lib/*.h toys.h - $(CC) $(CCFLAGS) -I . $(toyfiles) -o toybox_unstripped $(OPTIMIZE) +install_flat: + scripts/install.sh --symlink --force -toybox: toybox_unstripped - $(STRIP) toybox_unstripped -o toybox +install_airlock: + scripts/install.sh --symlink --force --airlock -toys/help.c: toys/help.h +install: + scripts/install.sh --long --symlink --force -toys/help.h: Config.in toys/Config.in scripts/config2help.py - scripts/config2help.py Config.in > toys/help.h +uninstall_flat: + scripts/install.sh --uninstall -instlist: toybox - $(HOSTCC) $(CCFLAGS) -I . scripts/install.c -o instlist +uninstall: + scripts/install.sh --long --uninstall -install_flat: instlist - @mkdir -p $(PREFIX)/ - @cp toybox $(PREFIX)/ - @for i in `./instlist`; do ln -s toybox "$(PREFIX)/$$i"; done +change: + scripts/change.sh clean:: - rm -f toybox toybox_unstripped gen_config.h instlist + rm -rf toybox generated change .singleconfig* +# If singlemake was in generated/ "make clean; make test_ls" wouldn't work. distclean: clean - rm -f toybox_old .config* - -test: tests + rm -f toybox_old .config* .singlemake tests: - scripts/testall.sh + scripts/test.sh help:: - @echo ' baseline - Create busybox_old for use by bloatcheck.' + @echo ' toybox - Build toybox.' + @echo ' COMMANDNAME - Build individual toybox command as a standalone binary.' + @echo ' list - List COMMANDNAMEs you can build standalone.' + @echo ' list_pending - List unfinished COMMANDNAMEs out of toys/pending.' + @echo ' change - Build each command standalone under change/.' + @echo ' baseline - Create toybox_old for use by bloatcheck.' @echo ' bloatcheck - Report size differences between old and current versions' + @echo ' test_COMMAND - Run tests for COMMAND (test_ps, test_cat, etc.)' + @echo ' tests - Run test suite against all compiled commands.' + @echo ' export TEST_HOST=1 to test host command, VERBOSE=1' + @echo ' to show diff, VERBOSE=fail to stop after first failure.' + @echo ' clean - Delete temporary files.' + @echo " distclean - Delete everything that isn't shipped." + @echo ' install_airlock - Install toybox and host toolchain into $$PREFIX directory' + @echo ' (providing $$PATH for hermetic builds).' + @echo ' install_flat - Install toybox into $$PREFIX directory.' + @echo ' install - Install toybox into subdirectories of $$PREFIX.' + @echo ' uninstall_flat - Remove toybox from $$PREFIX directory.' + @echo ' uninstall - Remove toybox from subdirectories of $$PREFIX.' + @echo '' + @echo 'example: CFLAGS="--static" CROSS_COMPILE=armv5l- make defconfig toybox install' + @echo ''