# Makefile for busybox
#
-# Copyright (C) 1999-2002 Erik Andersen <andersee@debian.org>
+# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
endif
endif
+ifeq ($(CONFIG_UDHCPD), y)
+CONFIG_UDHCP_LEASES_FILE=y
+else
+ifeq ($(CONFIG_UDHCPD), y)
+CONFIG_UDHCP_LEASES_FILE=y
+else
+CONFIG_UDHCP_LEASES_FILE=n
+endif
+endif
+
UDHCP-y:=
-UDHCP-$(CONFIG_UDHCP_SHARED) += options.o socket.o packet.o pidfile.o
-UDHCP-$(CONFIG_UDHCPC) += dhcpc.o clientpacket.o script.o
-UDHCP-$(CONFIG_UDHCPD) += dhcpd.o arpping.o files.o leases.o serverpacket.o
-UDHCP-$(CONFIG_DUMPLEASES) += dumpleases.o
+UDHCP-$(CONFIG_UDHCP_SHARED) += options.c socket.c packet.c common.c
+UDHCP-$(CONFIG_UDHCPC) += dhcpc.c clientpacket.c script.c
+UDHCP-$(CONFIG_UDHCPD) += dhcpd.c arpping.c files.c leases.c serverpacket.c
+UDHCP-$(CONFIG_DUMPLEASES) += dumpleases.c
+UDHCP-$(CONFIG_UDHCP_LEASES_FILE) += leases_file.c
+UDHCP_OBJS=$(patsubst %.c,$(UDHCP_DIR)%.o, $(UDHCP-y))
libraries-y+=$(UDHCP_DIR)$(UDHCP_AR)
-$(UDHCP_DIR)$(UDHCP_AR): $(patsubst %,$(UDHCP_DIR)%, $(UDHCP-y))
- $(AR) -ro $@ $(patsubst %,$(UDHCP_DIR)%, $(UDHCP-y))
-
-$(UDHCP_DIR)dhcpc.o: $(UDHCP_DIR)dhcpc.c
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DCOMBINED_BINARY -c $< -o $@
-
-$(UDHCP_DIR)dhcpd.o: $(UDHCP_DIR)dhcpd.c
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DCOMBINED_BINARY -c $< -o $@
+$(UDHCP_DIR)$(UDHCP_AR): $(UDHCP_OBJS)
+ $(AR) -ro $@ $(UDHCP_OBJS)
-$(UDHCP_DIR)dumpleases.o: $(UDHCP_DIR)dumpleases.c
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DCOMBINED_BINARY -c $< -o $@
+$(UDHCP_OBJS): %.o : %.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@