blob: 02d379445ebdbcefaa2d11f0b7d296606e49f444 [file] [log] [blame]
Eric Andersen85208e22002-04-12 12:05:57 +00001# Makefile for busybox
2#
Mike Frysinger0d4ee682005-09-24 06:01:57 +00003# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
Eric Andersen85208e22002-04-12 12:05:57 +00004#
Mike Frysinger0d4ee682005-09-24 06:01:57 +00005# Licensed under the GPL v2, see the file LICENSE in this tarball.
Eric Andersen85208e22002-04-12 12:05:57 +00006
7INIT_AR:=init.a
8ifndef $(INIT_DIR)
Eric Andersen7daa0762004-10-08 07:46:08 +00009INIT_DIR:=$(top_builddir)/init/
Eric Andersen85208e22002-04-12 12:05:57 +000010endif
Eric Andersen7daa0762004-10-08 07:46:08 +000011srcdir=$(top_srcdir)/init
Eric Andersen85208e22002-04-12 12:05:57 +000012
13INIT-y:=
14INIT-$(CONFIG_HALT) += halt.o
15INIT-$(CONFIG_INIT) += init.o
Glenn L McGrath061c9002002-09-16 04:21:46 +000016INIT-$(CONFIG_MESG) += mesg.o
Eric Andersen85208e22002-04-12 12:05:57 +000017INIT-$(CONFIG_POWEROFF) += poweroff.o
18INIT-$(CONFIG_REBOOT) += reboot.o
Eric Andersen85208e22002-04-12 12:05:57 +000019
Bernhard Reutner-Fischer7ca61b62006-01-15 14:04:57 +000020ifeq ($(strip $(CONFIG_HALT)),y)
Eric Andersenb01ed652003-06-27 17:08:15 +000021CONFIG_INIT_SHARED=y
22else
Bernhard Reutner-Fischer7ca61b62006-01-15 14:04:57 +000023ifeq ($(strip $(CONFIG_INIT)),y)
Eric Andersenb01ed652003-06-27 17:08:15 +000024CONFIG_INIT_SHARED=y
25else
Bernhard Reutner-Fischer7ca61b62006-01-15 14:04:57 +000026ifeq ($(strip $(CONFIG_POWEROFF)),y)
Eric Andersenb01ed652003-06-27 17:08:15 +000027CONFIG_INIT_SHARED=y
28else
Bernhard Reutner-Fischer7ca61b62006-01-15 14:04:57 +000029ifeq ($(strip $(CONFIG_REBOOT)),y)
Eric Andersenb01ed652003-06-27 17:08:15 +000030CONFIG_INIT_SHARED=y
31else
32CONFIG_INIT_SHARED=n
33endif
34endif
35endif
36endif
37
Bernhard Reutner-Fischer7ca61b62006-01-15 14:04:57 +000038ifeq ($(strip $(CONFIG_INIT_SHARED)),y)
Eric Andersenb01ed652003-06-27 17:08:15 +000039INIT-$(CONFIG_INIT_SHARED) += init_shared.o
40endif
41
Eric Andersen85208e22002-04-12 12:05:57 +000042libraries-y+=$(INIT_DIR)$(INIT_AR)
43
Bernhard Reutner-Fischer7ca61b62006-01-15 14:04:57 +000044INIT_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(INIT-y))
45INIT_SRC-a:=$(wildcard $(srcdir)/*.c)
46APPLET_SRC-y+=$(INIT_SRC-y)
47APPLET_SRC-a+=$(INIT_SRC-a)
48
Eric Andersen85208e22002-04-12 12:05:57 +000049$(INIT_DIR)$(INIT_AR): $(patsubst %,$(INIT_DIR)%, $(INIT-y))
Mike Frysinger4d008962005-07-27 01:09:24 +000050 $(AR) $(ARFLAGS) $@ $(patsubst %,$(INIT_DIR)%, $(INIT-y))
Eric Andersen85208e22002-04-12 12:05:57 +000051
Eric Andersen7daa0762004-10-08 07:46:08 +000052$(INIT_DIR)%.o: $(srcdir)/%.c
53 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
54