Eric Andersen | 85208e2 | 2002-04-12 12:05:57 +0000 | [diff] [blame] | 1 | # Makefile for busybox |
| 2 | # |
Mike Frysinger | 0d4ee68 | 2005-09-24 06:01:57 +0000 | [diff] [blame] | 3 | # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> |
Eric Andersen | 85208e2 | 2002-04-12 12:05:57 +0000 | [diff] [blame] | 4 | # |
Mike Frysinger | 0d4ee68 | 2005-09-24 06:01:57 +0000 | [diff] [blame] | 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. |
Eric Andersen | 85208e2 | 2002-04-12 12:05:57 +0000 | [diff] [blame] | 6 | |
| 7 | INIT_AR:=init.a |
| 8 | ifndef $(INIT_DIR) |
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 9 | INIT_DIR:=$(top_builddir)/init/ |
Eric Andersen | 85208e2 | 2002-04-12 12:05:57 +0000 | [diff] [blame] | 10 | endif |
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 11 | srcdir=$(top_srcdir)/init |
Eric Andersen | 85208e2 | 2002-04-12 12:05:57 +0000 | [diff] [blame] | 12 | |
| 13 | INIT-y:= |
| 14 | INIT-$(CONFIG_HALT) += halt.o |
| 15 | INIT-$(CONFIG_INIT) += init.o |
Glenn L McGrath | 061c900 | 2002-09-16 04:21:46 +0000 | [diff] [blame] | 16 | INIT-$(CONFIG_MESG) += mesg.o |
Eric Andersen | 85208e2 | 2002-04-12 12:05:57 +0000 | [diff] [blame] | 17 | INIT-$(CONFIG_POWEROFF) += poweroff.o |
| 18 | INIT-$(CONFIG_REBOOT) += reboot.o |
Eric Andersen | 85208e2 | 2002-04-12 12:05:57 +0000 | [diff] [blame] | 19 | |
Bernhard Reutner-Fischer | 7ca61b6 | 2006-01-15 14:04:57 +0000 | [diff] [blame^] | 20 | ifeq ($(strip $(CONFIG_HALT)),y) |
Eric Andersen | b01ed65 | 2003-06-27 17:08:15 +0000 | [diff] [blame] | 21 | CONFIG_INIT_SHARED=y |
| 22 | else |
Bernhard Reutner-Fischer | 7ca61b6 | 2006-01-15 14:04:57 +0000 | [diff] [blame^] | 23 | ifeq ($(strip $(CONFIG_INIT)),y) |
Eric Andersen | b01ed65 | 2003-06-27 17:08:15 +0000 | [diff] [blame] | 24 | CONFIG_INIT_SHARED=y |
| 25 | else |
Bernhard Reutner-Fischer | 7ca61b6 | 2006-01-15 14:04:57 +0000 | [diff] [blame^] | 26 | ifeq ($(strip $(CONFIG_POWEROFF)),y) |
Eric Andersen | b01ed65 | 2003-06-27 17:08:15 +0000 | [diff] [blame] | 27 | CONFIG_INIT_SHARED=y |
| 28 | else |
Bernhard Reutner-Fischer | 7ca61b6 | 2006-01-15 14:04:57 +0000 | [diff] [blame^] | 29 | ifeq ($(strip $(CONFIG_REBOOT)),y) |
Eric Andersen | b01ed65 | 2003-06-27 17:08:15 +0000 | [diff] [blame] | 30 | CONFIG_INIT_SHARED=y |
| 31 | else |
| 32 | CONFIG_INIT_SHARED=n |
| 33 | endif |
| 34 | endif |
| 35 | endif |
| 36 | endif |
| 37 | |
Bernhard Reutner-Fischer | 7ca61b6 | 2006-01-15 14:04:57 +0000 | [diff] [blame^] | 38 | ifeq ($(strip $(CONFIG_INIT_SHARED)),y) |
Eric Andersen | b01ed65 | 2003-06-27 17:08:15 +0000 | [diff] [blame] | 39 | INIT-$(CONFIG_INIT_SHARED) += init_shared.o |
| 40 | endif |
| 41 | |
Eric Andersen | 85208e2 | 2002-04-12 12:05:57 +0000 | [diff] [blame] | 42 | libraries-y+=$(INIT_DIR)$(INIT_AR) |
| 43 | |
Bernhard Reutner-Fischer | 7ca61b6 | 2006-01-15 14:04:57 +0000 | [diff] [blame^] | 44 | INIT_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(INIT-y)) |
| 45 | INIT_SRC-a:=$(wildcard $(srcdir)/*.c) |
| 46 | APPLET_SRC-y+=$(INIT_SRC-y) |
| 47 | APPLET_SRC-a+=$(INIT_SRC-a) |
| 48 | |
Eric Andersen | 85208e2 | 2002-04-12 12:05:57 +0000 | [diff] [blame] | 49 | $(INIT_DIR)$(INIT_AR): $(patsubst %,$(INIT_DIR)%, $(INIT-y)) |
Mike Frysinger | 4d00896 | 2005-07-27 01:09:24 +0000 | [diff] [blame] | 50 | $(AR) $(ARFLAGS) $@ $(patsubst %,$(INIT_DIR)%, $(INIT-y)) |
Eric Andersen | 85208e2 | 2002-04-12 12:05:57 +0000 | [diff] [blame] | 51 | |
Eric Andersen | 7daa076 | 2004-10-08 07:46:08 +0000 | [diff] [blame] | 52 | $(INIT_DIR)%.o: $(srcdir)/%.c |
| 53 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< |
| 54 | |