Makefile - sdhcp - simple dhcp client
(HTM) git clone git://git.codemadness.org/sdhcp
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
Makefile (1344B)
---
1 include config.mk
2
3 .POSIX:
4 .SUFFIXES: .c .o
5
6 HDR = util.h arg.h
7 LIB = \
8 util/strlcpy.o \
9 util/eprintf.o
10
11 SRC = sdhcp.c
12
13 OBJ = $(SRC:.c=.o) $(LIB)
14 BIN = $(SRC:.c=)
15 MAN = $(SRC:.c=.1)
16
17 all: options binlib
18
19 options:
20 @echo sdhcp build options:
21 @echo "CFLAGS = ${CFLAGS}"
22 @echo "LDFLAGS = ${LDFLAGS}"
23 @echo "CC = ${CC}"
24
25 binlib: util.a
26 $(MAKE) bin
27
28 bin: $(BIN)
29
30 $(OBJ): $(HDR) config.mk
31
32 .o:
33 @echo LD $@
34 @$(LD) -o $@ $< util.a $(LDFLAGS)
35
36 .c.o:
37 @echo CC $<
38 @$(CC) -c -o $@ $< $(CFLAGS)
39
40 util.a: $(LIB)
41 @echo AR $@
42 @$(AR) -r -c $@ $(LIB)
43 @ranlib $@
44
45 install: all
46 @echo installing executables to $(DESTDIR)$(PREFIX)/sbin
47 @mkdir -p $(DESTDIR)$(PREFIX)/sbin
48 @cp -f $(BIN) $(DESTDIR)$(PREFIX)/sbin
49 @cd $(DESTDIR)$(PREFIX)/sbin && chmod 755 $(BIN)
50 @echo installing manual pages to $(DESTDIR)$(MANPREFIX)/man1
51 @mkdir -p $(DESTDIR)$(MANPREFIX)/man1
52 @for m in $(MAN); do sed "s/VERSION/$(VERSION)/g" < "$$m" > $(DESTDIR)$(MANPREFIX)/man1/"$$m"; done
53 @cd $(DESTDIR)$(MANPREFIX)/man1 && chmod 644 $(MAN)
54
55 uninstall:
56 @echo removing executables from $(DESTDIR)$(PREFIX)/sbin
57 @cd $(DESTDIR)$(PREFIX)/sbin && rm -f $(BIN)
58 @echo removing manual pages from $(DESTDIR)$(MANPREFIX)/man1
59 @cd $(DESTDIR)$(MANPREFIX)/man1 && rm -f $(MAN)
60
61 clean:
62 @echo cleaning
63 @rm -f $(BIN) $(OBJ) util.a
64
65 .PHONY: all options clean install uninstall