summaryrefslogtreecommitdiffstats
path: root/make/dhcp_relay.mk
blob: a5e24d1ef349960419a30d9e25d9594efc1871f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#############################################################
#
# dhcp_relay
#
#############################################################
DHCP_RELAY_SOURCE:=dhcp-3.0pl2.tar.gz
DHCP_RELAY_SITE:=ftp://ftp.isc.org/isc/dhcp
DHCP_RELAY_CAT:=zcat
DHCP_RELAY_DIR:=$(BUILD_DIR)/dhcp-3.0pl2
DHCP_RELAY_BINARY:=work.linux-2.2/relay/dhcrelay
DHCP_RELAY_TARGET_BINARY:=usr/sbin/dhcrelay
BVARS=PREDEFINES='-D_PATH_DHCPD_DB=\"/var/lib/dhcp/dhcpd.leases\" \
	-D_PATH_DHCLIENT_DB=\"/var/lib/dhcp/dhclient.leases\"' \
	VARDB=/var/lib/dhcp

$(DL_DIR)/$(DHCP_RELAY_SOURCE):
	 $(WGET) -P $(DL_DIR) $(DHCP_RELAY_SITE)/$(DHCP_RELAY_SOURCE)

dhcp_relay-source: $(DL_DIR)/$(DHCP_RELAY_SOURCE)

$(DHCP_RELAY_DIR)/.unpacked: $(DL_DIR)/$(DHCP_RELAY_SOURCE)
	$(DHCP_RELAY_CAT) $(DL_DIR)/$(DHCP_RELAY_SOURCE) | tar -C $(BUILD_DIR) -xvf -
	touch $(DHCP_RELAY_DIR)/.unpacked

$(DHCP_RELAY_DIR)/.configured: $(DHCP_RELAY_DIR)/.unpacked
	(cd $(DHCP_RELAY_DIR); PATH=$(STAGING_DIR)/bin:$$PATH \
		CC=$(TARGET_CC) \
		./configure \
	);
	touch  $(DHCP_RELAY_DIR)/.configured

$(DHCP_RELAY_DIR)/$(DHCP_RELAY_BINARY): $(DHCP_RELAY_DIR)/.configured
	$(MAKE) CC=$(TARGET_CC) $(BVARS) -C $(DHCP_RELAY_DIR)
	$(STRIP) $(DHCP_RELAY_DIR)/$(DHCP_RELAY_BINARY)

$(TARGET_DIR)/$(DHCP_RELAY_TARGET_BINARY): $(DHCP_RELAY_DIR)/$(DHCP_RELAY_BINARY)
	(cd $(TARGET_DIR)/var/lib; ln -sf /tmp dhcp)
	cp -a $(DHCP_RELAY_DIR)/$(DHCP_RELAY_BINARY) $(TARGET_DIR)/$(DHCP_RELAY_TARGET_BINARY) 
	rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
		$(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc

dhcp_relay: uclibc $(TARGET_DIR)/$(DHCP_RELAY_TARGET_BINARY)

dhcp_relay-clean:
	$(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(DHCP_RELAY_DIR) uninstall
	-$(MAKE) -C $(DHCP_RELAY_DIR) clean

dhcp_relay-dirclean:
	rm -rf $(DHCP_RELAY_DIR)