blob: ca00b647d8d53d47a2888e52b31453609779c856 [file] [log] [blame]
Russ Dill61fb4892002-10-14 21:41:28 +00001# Makefile for busybox
2#
Eric Andersenc7bda1c2004-03-15 08:29:22 +00003# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
Russ Dill61fb4892002-10-14 21:41:28 +00004#
Bernhard Reutner-Fischer7ca61b62006-01-15 14:04:57 +00005# Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
Russ Dill61fb4892002-10-14 21:41:28 +00006
Eric Andersen7daa0762004-10-08 07:46:08 +00007srcdir=$(top_srcdir)/networking/udhcp
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +00008objdir=$(top_builddir)/networking/udhcp
Russ Dill61fb4892002-10-14 21:41:28 +00009
10#ok, so I forgot how to do an or, but this is a quick and dirty hack
Bernhard Reutner-Fischer7ca61b62006-01-15 14:04:57 +000011ifeq ($(strip $(CONFIG_UDHCPC)),y)
Russ Dill61fb4892002-10-14 21:41:28 +000012CONFIG_UDHCP_SHARED=y
13else
Bernhard Reutner-Fischer7ca61b62006-01-15 14:04:57 +000014ifeq ($(strip $(CONFIG_UDHCPD)),y)
Russ Dill61fb4892002-10-14 21:41:28 +000015CONFIG_UDHCP_SHARED=y
16else
17CONFIG_UDHCP_SHARED=n
18endif
19endif
20
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +000021UDHCP__SHARED_FILES:=common.c options.c packet.c pidfile.c signalpipe.c socket.c
22UDHCP__UDHCPC_FILES:=dhcpc.c clientpacket.c clientsocket.c script.c
23UDHCP__UDHCPD_FILES:=dhcpd.c arpping.c files.c leases.c serverpacket.c \
24 static_leases.c
25UDHCP__DUMPLEASES_FILES:=dumpleases.c
Russ Dill61fb4892002-10-14 21:41:28 +000026
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +000027UDHCP-$(CONFIG_UDHCP_SHARED) += $(UDHCP__SHARED_FILES)
28UDHCP-$(CONFIG_UDHCPC) += $(UDHCP__UDHCPC_FILES)
29UDHCP-$(CONFIG_UDHCPD) += $(UDHCP__UDHCPD_FILES)
30UDHCP-$(CONFIG_DUMPLEASES) += $(UDHCP__DUMPLEASES_FILES)
Russ Dill61fb4892002-10-14 21:41:28 +000031
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +000032UDHCP_SRC-y:=$(patsubst %,$(srcdir)/%,$(UDHCP-y))
33UDHCP_SRC-a:=$(wildcard $(srcdir)/*.c)
34APPLET_SRC-y+=$(UDHCP_SRC-y)
35APPLET_SRC-a+=$(UDHCP_SRC-a)
Bernhard Reutner-Fischer7ca61b62006-01-15 14:04:57 +000036
37UDHCP_INCLUDES:=$(srcdir)
38
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +000039#APPLETS_DEFINE-y+= -I$(UDHCP_INCLUDES) -DIN_BUSYBOX
40#APPLETS_DEFINE-a+= -I$(UDHCP_INCLUDES) -DIN_BUSYBOX
Bernhard Reutner-Fischer7ca61b62006-01-15 14:04:57 +000041
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +000042CFLAGS-udhcp:= -I$(UDHCP_INCLUDES)
Russ Dill61fb4892002-10-14 21:41:28 +000043
Bernhard Reutner-Fischer5d261262006-03-01 22:54:48 +000044# bug in make-3.80 prevents this:
45#define udhcp__flags
46#CFLAGS-udhcp-$(1):=-DIN_BUSYBOX
47#endef
48#
49#ifeq ($(CONFIG_UDHCP_SHARED),y)
50#$(foreach f,$(UDHCP__SHARED_FILES),$(eval $(call udhcp__flags,$(f))))
51#endif
52#ifeq ($(CONFIG_UDHCPC),y)
53#$(foreach f,$(UDHCP__UDHCPC_FILES),$(eval $(call udhcp__flags,$(f))))
54#endif
55#ifeq ($(CONFIG_UDHCPD),y)
56#$(foreach f,$(UDHCP__UDHCPD_FILES),$(eval $(call udhcp__flags,$(f))))
57#endif
58#ifeq ($(CONFIG_DUMPLEASES),y)
59#$(foreach f,$(UDHCP__DUMPLEASES_FILES),$(eval $(call udhcp__flags,$(f))))
60#endif
61
62ifeq ($(CONFIG_UDHCP_SHARED),y)
63CFLAGS-udhcp-common.c:=-DIN_BUSYBOX
64CFLAGS-udhcp-options.c:=-DIN_BUSYBOX
65CFLAGS-udhcp-packet.c:=-DIN_BUSYBOX
66CFLAGS-udhcp-pidfile.c:=-DIN_BUSYBOX
67CFLAGS-udhcp-signalpipe.c:=-DIN_BUSYBOX
68CFLAGS-udhcp-socket.c:=-DIN_BUSYBOX
69endif
70ifeq ($(CONFIG_UDHCPC),y)
71CFLAGS-udhcp-dhcpc.c:=-DIN_BUSYBOX
72CFLAGS-udhcp-clientpacket.c:=-DIN_BUSYBOX
73CFLAGS-udhcp-clientsocket.c:=-DIN_BUSYBOX
74CFLAGS-udhcp-script.c:=-DIN_BUSYBOX
75endif
76ifeq ($(CONFIG_UDHCPD),y)
77CFLAGS-udhcp-dhcpd.c:=-DIN_BUSYBOX
78CFLAGS-udhcp-arpping.c:=-DIN_BUSYBOX
79CFLAGS-udhcp-files.c:=-DIN_BUSYBOX
80CFLAGS-udhcp-leases.c:=-DIN_BUSYBOX
81CFLAGS-udhcp-serverpacket.c:=-DIN_BUSYBOX
82CFLAGS-udhcp-static_leases.c:=-DIN_BUSYBOX
83endif
84ifeq ($(CONFIG_DUMPLEASES),y)
85CFLAGS-udhcp-dumpleases.c:=-DIN_BUSYBOX
86endif
87
88
89networking_udhcp_OBJ:=$(patsubst %.c,$(objdir)/%.o,$(UDHCP-y))
90