blob: 3aedbbffef82e42c0b64e5158953152dc7dbf594 [file] [log] [blame]
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001# Makefile for busybox
2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4#
Denys Vlasenko0ef64bd2010-08-16 20:14:46 +02005# Licensed under GPLv2, see file LICENSE in this source tree.
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00006
Denis Vlasenkod62fd842007-10-07 20:46:34 +00007obj-y :=
8obj-y += applets.o
Denis Vlasenko52b5eba2006-10-19 22:11:06 +00009
Denis Vlasenko432d69c2007-06-14 21:41:15 +000010hostprogs-y:=
Denys Vlasenkoacabf8f2009-10-02 01:10:32 +020011hostprogs-y += usage usage_pod applet_tables
Denis Vlasenko432d69c2007-06-14 21:41:15 +000012
Denis Vlasenkod62fd842007-10-07 20:46:34 +000013always:= $(hostprogs-y)
Denis Vlasenko432d69c2007-06-14 21:41:15 +000014
15# Generated files need additional love
Denis Vlasenkob5605772006-10-19 22:12:47 +000016
Denis Vlasenkoa29c9352009-04-19 12:15:51 +000017# This trick decreases amount of rebuilds
18# if tree is merely renamed/copied
Denis Vlasenkof66fe9a2009-04-19 14:12:50 +000019ifeq ($(srctree),$(objtree))
Denis Vlasenkoa29c9352009-04-19 12:15:51 +000020srctree_slash =
21else
22srctree_slash = $(srctree)/
23endif
24
Denys Vlasenkoacabf8f2009-10-02 01:10:32 +020025HOSTCFLAGS_usage.o = -I$(srctree_slash)include -Iinclude
26HOSTCFLAGS_usage_pod.o = -I$(srctree_slash)include -Iinclude
Denis Vlasenko432d69c2007-06-14 21:41:15 +000027
Denis Vlasenko745cd172007-11-29 03:31:20 +000028applets/applets.o: include/usage_compressed.h include/applet_tables.h
Denis Vlasenko1aa7e472007-11-28 06:49:03 +000029
Denys Vlasenko6c5bf0d2010-06-06 00:53:45 +020030applets/applet_tables: .config include/applets.h
31applets/usage: .config include/applets.h
Denys Vlasenkod8e61bb2016-08-21 22:00:20 +020032applets/usage_pod: .config include/applets.h include/applet_tables.h
Denis Vlasenko745cd172007-11-29 03:31:20 +000033
34quiet_cmd_gen_usage_compressed = GEN include/usage_compressed.h
Denis Vlasenkoa29c9352009-04-19 12:15:51 +000035 cmd_gen_usage_compressed = $(srctree_slash)applets/usage_compressed include/usage_compressed.h applets
Denis Vlasenko1aa7e472007-11-28 06:49:03 +000036
Denis Vlasenkoa29c9352009-04-19 12:15:51 +000037include/usage_compressed.h: applets/usage $(srctree_slash)applets/usage_compressed
Mike Frysingere5c09532007-01-02 05:42:35 +000038 $(call cmd,gen_usage_compressed)
Denis Vlasenko1aa7e472007-11-28 06:49:03 +000039
Denys Vlasenkod8e61bb2016-08-21 22:00:20 +020040quiet_cmd_gen_applet_tables = GEN include/applet_tables.h include/NUM_APPLETS.h
Denys Vlasenko1fcbff22010-06-26 02:40:08 +020041 cmd_gen_applet_tables = applets/applet_tables include/applet_tables.h include/NUM_APPLETS.h
Denis Vlasenko745cd172007-11-29 03:31:20 +000042
Denys Vlasenkod8e61bb2016-08-21 22:00:20 +020043include/NUM_APPLETS.h: applets/applet_tables
44 $(call cmd,gen_applet_tables)
45
46# In fact, include/applet_tables.h depends only on applets/applet_tables,
47# and is generated by it. But specifying only it can run
48# applets/applet_tables twice, possibly in parallel.
49# We say that it also needs NUM_APPLETS.h
50#
51# Unfortunately, we need to list the same command,
52# and it can be executed twice (sequentially).
53# The alternative is to not list any command,
54# and then if include/applet_tables.h is deleted, it won't be rebuilt.
55#
56include/applet_tables.h: include/NUM_APPLETS.h applets/applet_tables
Denys Vlasenkobff5f3f2011-03-06 23:48:24 +010057 $(call cmd,gen_applet_tables)