blob: 5b3d9eaf0ff79cc65bf2150be4dc4d8be77c6ef1 [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
Eric Andersenb01ed652003-06-27 17:08:15 +000020ifeq ($(CONFIG_HALT), y)
21CONFIG_INIT_SHARED=y
22else
23ifeq ($(CONFIG_INIT), y)
24CONFIG_INIT_SHARED=y
25else
26ifeq ($(CONFIG_POWEROFF), y)
27CONFIG_INIT_SHARED=y
28else
29ifeq ($(CONFIG_REBOOT), y)
30CONFIG_INIT_SHARED=y
31else
32CONFIG_INIT_SHARED=n
33endif
34endif
35endif
36endif
37
38ifeq ($(CONFIG_INIT_SHARED), y)
39INIT-$(CONFIG_INIT_SHARED) += init_shared.o
40endif
41
Eric Andersen85208e22002-04-12 12:05:57 +000042libraries-y+=$(INIT_DIR)$(INIT_AR)
43
44$(INIT_DIR)$(INIT_AR): $(patsubst %,$(INIT_DIR)%, $(INIT-y))
Mike Frysinger4d008962005-07-27 01:09:24 +000045 $(AR) $(ARFLAGS) $@ $(patsubst %,$(INIT_DIR)%, $(INIT-y))
Eric Andersen85208e22002-04-12 12:05:57 +000046
Eric Andersen7daa0762004-10-08 07:46:08 +000047$(INIT_DIR)%.o: $(srcdir)/%.c
48 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
49