File: Makefile

package info (click to toggle)
udhcp 0.9.8cvs20050124-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 464 kB
  • ctags: 356
  • sloc: ansic: 2,774; makefile: 243; sh: 195
file content (103 lines) | stat: -rw-r--r-- 2,573 bytes parent folder | download | duplicates (3)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# udhcp makefile

DESTDIR     = 
prefix      = /usr
SBINDIR     = /sbin
USRSBINDIR  = $(DESTDIR)${prefix}/sbin
USRBINDIR   = $(DESTDIR)${prefix}/bin
USRSHAREDIR = $(DESTDIR)${prefix}/share

# Uncomment this to get a shared binary. Call as udhcpd for the server,
# and udhcpc for the client
#COMBINED_BINARY=1

# Uncomment this for extra output and to compile with debugging symbols
#UDHCP_DEBUG=1

# Uncomment this to output messages to syslog, otherwise, messages go to stdout
CFLAGS += -DUDHCP_SYSLOG

#CROSS_COMPILE=arm-uclibc-
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)gcc
INSTALL = install

OBJS_SHARED = common.o options.o packet.o pidfile.o signalpipe.o socket.o
DHCPD_OBJS = dhcpd.o arpping.o files.o leases.o serverpacket.o static_leases.o
DHCPC_OBJS = dhcpc.o clientpacket.o clientsocket.o script.o

ifdef COMBINED_BINARY
EXEC1 = udhcpd
OBJS1 = $(DHCPD_OBJS) $(DHCPC_OBJS) $(OBJS_SHARED) frontend.o
CFLAGS += -DCOMBINED_BINARY
else
EXEC1 = udhcpd
OBJS1 = $(DHCPD_OBJS) $(OBJS_SHARED)

EXEC2 = udhcpc
OBJS2 = $(DHCPC_OBJS) $(OBJS_SHARED)
endif

EXEC3 = dumpleases
OBJS3 = dumpleases.o

BOOT_PROGRAM = udhcpc
DAEMON = udhcpd
COMMAND = dumpleases

ifdef UDHCP_SYSLOG
CFLAGS += -DUDHCP_SYSLOG
endif

CFLAGS += -W -Wall -Wstrict-prototypes -D_GNU_SOURCE

ifdef UDHCP_DEBUG
CFLAGS += -g -DUDHCP_DEBUG
STRIP=true
else
CFLAGS += -Os -fomit-frame-pointer
STRIP=$(CROSS_COMPILE)strip
endif

all: $(EXEC1) $(EXEC2) $(EXEC3)
	$(STRIP) --remove-section=.note --remove-section=.comment $(EXEC1) $(EXEC2) $(EXEC3)

$(OBJS1) $(OBJS2) $(OBJS3): *.h Makefile
$(EXEC1) $(EXEC2) $(EXEC3): Makefile

.c.o:
	$(CC) -c $(CFLAGS) $<
	
$(EXEC1): $(OBJS1)
	$(LD) $(LDFLAGS) $(OBJS1) -o $(EXEC1)

$(EXEC2): $(OBJS2)
	$(LD) $(LDFLAGS) $(OBJS2) -o $(EXEC2)

$(EXEC3): $(OBJS3)
	$(LD) $(LDFLAGS) $(OBJS3) -o $(EXEC3)


install: all
	mkdir -p $(USRSBINDIR) $(USRBINDIR) 
	$(INSTALL) -m 755 $(DAEMON) $(USRSBINDIR)
	$(INSTALL) -m 755 $(COMMAND) $(USRBINDIR)
ifdef COMBINED_BINARY
	ln -sf $(DAEMON) $(USRSBINDIR)/$(BOOT_PROGRAM)
else
	$(INSTALL) -m 755 $(BOOT_PROGRAM) $(USRSBINDIR)
endif
	mkdir -p $(USRSHAREDIR)/udhcpc
	for name in bound deconfig nak renew script ; do \
		$(INSTALL) -m 755 samples/sample.$$name \
			$(USRSHAREDIR)/udhcpc/default.$$name ; \
	done
	mkdir -p $(USRSHAREDIR)/man/man1
	$(INSTALL) -m 644 dumpleases.1 $(USRSHAREDIR)/man/man1
	mkdir -p $(USRSHAREDIR)/man/man5
	$(INSTALL) -m 644 udhcpd.conf.5 $(USRSHAREDIR)/man/man5
	mkdir -p $(USRSHAREDIR)/man/man8
	$(INSTALL) -m 644 udhcpc.8 udhcpd.8 $(USRSHAREDIR)/man/man8

clean:
	-rm -f udhcpd udhcpc dumpleases *.o core