Introduction
Introduction Statistics Contact Development Disclaimer Help
use suckless style makefile - sdhcp - simple dhcp client
git clone git://git.codemadness.org/sdhcp
Log
Files
Refs
LICENSE
---
commit 61b1942be50463eb03c55c055df4b8f62a4549e2
parent 0d4e3b57668dbabd501b83f2228d18b0a53598d0
Author: Hiltjo Posthuma <[email protected]>
Date: Fri, 25 Apr 2014 20:52:34 +0200
use suckless style makefile
- add config.mk,
- use -ansi and -D_BSD_SOURCE (needed for IFF_*) for CFLAGS.
Signed-off-by: Hiltjo Posthuma <[email protected]>
Diffstat:
M Makefile | 69 ++++++++++++++++++++++++++---…
A config.mk | 13 +++++++++++++
2 files changed, 71 insertions(+), 11 deletions(-)
---
diff --git a/Makefile b/Makefile
@@ -1,17 +1,64 @@
-DESTDIR=
-MANDIR = /usr/share/man
+include config.mk
-sdhcp: sdhcp.c
- $(CC) -O2 -o $@ sdhcp.c -static -Wall -ansi
+.POSIX:
+.SUFFIXES: .c .o
-debug: sdhcp.c debug.c
- $(CC) -DDEBUG -o sdhcp sdhcp.c -static -O0 -g -Wall -ansi
+HDR = util.h
+LIB = \
+ util/strlcpy.o
-all: sdhcp
+SRC = sdhcp.c
+
+OBJ = $(SRC:.c=.o) $(LIB)
+BIN = $(SRC:.c=)
+MAN = $(SRC:.c=.8)
+
+all: options binlib
+
+options:
+ @echo sdhcp build options:
+ @echo "CFLAGS = ${CFLAGS}"
+ @echo "LDFLAGS = ${LDFLAGS}"
+ @echo "CC = ${CC}"
+
+binlib: util.a
+ $(MAKE) bin
+
+bin: $(BIN)
+
+$(OBJ): $(HDR) config.mk
+
+.o:
+ @echo LD $@
+ @$(LD) -o $@ $< util.a $(LDFLAGS)
+
+.c.o:
+ @echo CC $<
+ @$(CC) -c -o $@ $< $(CFLAGS)
+
+util.a: $(LIB)
+ @echo AR $@
+ @$(AR) -r -c $@ $(LIB)
+ @ranlib $@
install: all
- install -s sdhcp $(DESTDIR)/sbin
- gzip -c sdhcp.8 > $(DESTDIR)$(MANDIR)/man8/sdhcp.8.gz
-
+ @echo installing executables to $(DESTDIR)$(PREFIX)/sbin
+ @mkdir -p $(DESTDIR)$(PREFIX)/sbin
+ @cp -f $(BIN) $(DESTDIR)$(PREFIX)/sbin
+ @cd $(DESTDIR)$(PREFIX)/sbin && chmod 755 $(BIN)
+ @echo installing manual pages to $(DESTDIR)$(MANPREFIX)/man8
+ @mkdir -p $(DESTDIR)$(MANPREFIX)/man8
+ @for m in $(MAN); do sed "s/VERSION/$(VERSION)/g" < "$$m" > $(DESTDIR)…
+ @cd $(DESTDIR)$(MANPREFIX)/man8 && chmod 644 $(MAN)
+
+uninstall:
+ @echo removing executables from $(DESTDIR)$(PREFIX)/bin
+ @cd $(DESTDIR)$(PREFIX)/bin && rm -f $(BIN)
+ @echo removing manual pages from $(DESTDIR)$(MANPREFIX)/man8
+ @cd $(DESTDIR)$(MANPREFIX)/man8 && rm -f $(MAN)
+
clean:
- rm -f sdhcp ?*~
+ @echo cleaning
+ @rm -f $(BIN) $(OBJ)
+
+.PHONY: all options clean install uninstall
diff --git a/config.mk b/config.mk
@@ -0,0 +1,13 @@
+# sdhcp version
+VERSION = 0.1
+
+PREFIX = /usr/local
+DESTDIR =
+MANPREFIX = $(PREFIX)/share/man
+
+#CC = gcc
+#CC = musl-gcc
+LD = $(CC)
+CPPFLAGS = -D_BSD_SOURCE
+CFLAGS = -g -Wall -ansi $(CPPFLAGS)
+LDFLAGS = -g
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.