busybox/applets/Kbuild.src
<<
>>
Prefs
   1# Makefile for busybox
   2#
   3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
   4#
   5# Licensed under GPLv2, see file LICENSE in this source tree.
   6
   7obj-y :=
   8obj-y += applets.o
   9
  10hostprogs-y:=
  11hostprogs-y += usage usage_pod applet_tables
  12
  13always:= $(hostprogs-y)
  14
  15# Generated files need additional love
  16
  17# This trick decreases amount of rebuilds
  18# if tree is merely renamed/copied
  19ifeq ($(srctree),$(objtree))
  20srctree_slash =
  21else
  22srctree_slash = $(srctree)/
  23endif
  24
  25HOSTCFLAGS_usage.o = -I$(srctree_slash)include -Iinclude
  26HOSTCFLAGS_usage_pod.o = -I$(srctree_slash)include -Iinclude
  27
  28applets/applets.o: include/usage_compressed.h include/applet_tables.h
  29
  30applets/applet_tables: .config include/applets.h
  31applets/usage:         .config include/applets.h
  32applets/usage_pod:     .config include/applets.h include/applet_tables.h
  33
  34quiet_cmd_gen_usage_compressed = GEN     include/usage_compressed.h
  35      cmd_gen_usage_compressed = $(srctree_slash)applets/usage_compressed include/usage_compressed.h applets
  36
  37include/usage_compressed.h: applets/usage $(srctree_slash)applets/usage_compressed
  38        $(call cmd,gen_usage_compressed)
  39
  40quiet_cmd_gen_applet_tables = GEN     include/applet_tables.h include/NUM_APPLETS.h
  41      cmd_gen_applet_tables = applets/applet_tables include/applet_tables.h include/NUM_APPLETS.h
  42
  43include/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
  57        $(call cmd,gen_applet_tables)
  58