* Build udhcpc binary from source.
[grml-terminalserver.git] / Makefile
index 78296ab..9d2651e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,14 +2,26 @@ install_ = "install"
 
 name = "grml-terminalserver"
 
+#ifndef CFLAGS
+CFLAGS = -Wall -O2
+#endif
+
 etc = ${DESTDIR}/etc/grml/terminalserver
 usr = ${DESTDIR}/usr
 usrbin = $(usr)/bin
 usrsbin = $(usr)/sbin
 usrshare = $(usr)/share/$(name)
 
+bin: timeout udhcpc
+
+timeout: timeout.c
+       diet gcc $(CFLAGS) $^ -o $@
+       strip --strip-unneeded $@
+
+udhcpc: udhcp
+       cd udhcp ; LDFLAGS='-static' make
 
-install:
+install: bin
        $(install_) -d -m 755 $(etc)
        $(install_) -m 644 config $(etc)
 
@@ -25,6 +37,7 @@ install:
        $(install_) -m 755 rdir $(usrshare)
        $(install_) -m 755 cdir $(usrshare)
        $(install_) -m 755 timeout $(usrshare)
+       $(install_) -m 755 udhcp/udhcpc $(usrshare)
        $(install_) -m 755 discover-nic $(usrshare)
        cp -r templates $(usrshare)
 
@@ -33,4 +46,4 @@ install:
        $(install_) -m 755 grml-terminalserver-config $(usrsbin)
 
 clean:
-       true
+       rm -f timeout ; cd udhcp && make clean && cd ..