10f66f451Sopenharmony_ci# Makefile for toybox.
20f66f451Sopenharmony_ci# Copyright 2006 Rob Landley <rob@landley.net>
30f66f451Sopenharmony_ci
40f66f451Sopenharmony_ci# If people set these on the make command line, use 'em
50f66f451Sopenharmony_ci# Note that CC defaults to "cc" so the one in configure doesn't get
60f66f451Sopenharmony_ci# used when scripts/make.sh and care called through "make".
70f66f451Sopenharmony_ci
80f66f451Sopenharmony_ciHOSTCC?=cc
90f66f451Sopenharmony_ci
100f66f451Sopenharmony_ciexport CROSS_COMPILE CFLAGS OPTIMIZE LDOPTIMIZE CC HOSTCC V STRIP
110f66f451Sopenharmony_ci
120f66f451Sopenharmony_ciall: toybox
130f66f451Sopenharmony_ci
140f66f451Sopenharmony_ciKCONFIG_CONFIG ?= .config
150f66f451Sopenharmony_ci
160f66f451Sopenharmony_citoybox_stuff: $(KCONFIG_CONFIG) *.[ch] lib/*.[ch] toys/*/*.c scripts/*.sh
170f66f451Sopenharmony_ci
180f66f451Sopenharmony_citoybox generated/unstripped/toybox: toybox_stuff
190f66f451Sopenharmony_ci	scripts/make.sh
200f66f451Sopenharmony_ci
210f66f451Sopenharmony_ci.PHONY: clean distclean baseline bloatcheck install install_flat \
220f66f451Sopenharmony_ci	uinstall uninstall_flat tests help toybox_stuff change \
230f66f451Sopenharmony_ci	list list_working list_pending root run_root
240f66f451Sopenharmony_ci
250f66f451Sopenharmony_ciinclude kconfig/Makefile
260f66f451Sopenharmony_ci-include .singlemake
270f66f451Sopenharmony_ci
280f66f451Sopenharmony_ci$(KCONFIG_CONFIG): $(KCONFIG_TOP)
290f66f451Sopenharmony_ci	@if [ -e "$(KCONFIG_CONFIG)" ]; then make silentoldconfig; \
300f66f451Sopenharmony_ci	else echo "Not configured (run 'make defconfig' or 'make menuconfig')";\
310f66f451Sopenharmony_ci	exit 1; fi
320f66f451Sopenharmony_ci
330f66f451Sopenharmony_ci$(KCONFIG_TOP): generated/Config.in generated/Config.probed
340f66f451Sopenharmony_cigenerated/Config.probed: generated/Config.in
350f66f451Sopenharmony_cigenerated/Config.in: toys/*/*.c scripts/genconfig.sh
360f66f451Sopenharmony_ci	scripts/genconfig.sh
370f66f451Sopenharmony_ci
380f66f451Sopenharmony_ci# Development targets
390f66f451Sopenharmony_cibaseline: generated/unstripped/toybox
400f66f451Sopenharmony_ci	@cp generated/unstripped/toybox generated/unstripped/toybox_old
410f66f451Sopenharmony_ci
420f66f451Sopenharmony_cibloatcheck: generated/unstripped/toybox_old generated/unstripped/toybox
430f66f451Sopenharmony_ci	@scripts/bloatcheck generated/unstripped/toybox_old generated/unstripped/toybox
440f66f451Sopenharmony_ci
450f66f451Sopenharmony_ciinstall_flat:
460f66f451Sopenharmony_ci	scripts/install.sh --symlink --force
470f66f451Sopenharmony_ci
480f66f451Sopenharmony_ciinstall_airlock:
490f66f451Sopenharmony_ci	scripts/install.sh --symlink --force --airlock
500f66f451Sopenharmony_ci
510f66f451Sopenharmony_ciinstall:
520f66f451Sopenharmony_ci	scripts/install.sh --long --symlink --force
530f66f451Sopenharmony_ci
540f66f451Sopenharmony_ciuninstall_flat:
550f66f451Sopenharmony_ci	scripts/install.sh --uninstall
560f66f451Sopenharmony_ci
570f66f451Sopenharmony_ciuninstall:
580f66f451Sopenharmony_ci	scripts/install.sh --long --uninstall
590f66f451Sopenharmony_ci
600f66f451Sopenharmony_cichange:
610f66f451Sopenharmony_ci	scripts/change.sh
620f66f451Sopenharmony_ci
630f66f451Sopenharmony_ciroot_clean:
640f66f451Sopenharmony_ci	@rm -rf root
650f66f451Sopenharmony_ci	@echo root cleaned
660f66f451Sopenharmony_ci
670f66f451Sopenharmony_ciclean::
680f66f451Sopenharmony_ci	@rm -rf toybox generated change .singleconfig* cross-log-*.*
690f66f451Sopenharmony_ci	@echo cleaned
700f66f451Sopenharmony_ci
710f66f451Sopenharmony_ci# If singlemake was in generated/ "make clean; make test_ls" wouldn't work.
720f66f451Sopenharmony_cidistclean: clean root_clean
730f66f451Sopenharmony_ci	@rm -f toybox* .config* .singlemake
740f66f451Sopenharmony_ci	@echo removed .config
750f66f451Sopenharmony_ci
760f66f451Sopenharmony_citests:
770f66f451Sopenharmony_ci	scripts/test.sh
780f66f451Sopenharmony_ci
790f66f451Sopenharmony_ciroot:
800f66f451Sopenharmony_ci	scripts/mkroot.sh $(MAKEFLAGS)
810f66f451Sopenharmony_ci
820f66f451Sopenharmony_cirun_root:
830f66f451Sopenharmony_ci	C=$$(basename "$$CROSS_COMPILE" | sed 's/-.*//'); \
840f66f451Sopenharmony_ci        cd root/"$${C:-host}" && ./qemu-*.sh $(MAKEFLAGS) || exit 1
850f66f451Sopenharmony_ci
860f66f451Sopenharmony_cihelp::
870f66f451Sopenharmony_ci	@cat scripts/help.txt
88