]> datadissipation.net git - ust.git/commitdiff
Makefile improvements
authorgit <redacted>
Mon, 16 Feb 2026 08:04:03 +0000 (03:04 -0500)
committergit <redacted>
Mon, 16 Feb 2026 08:04:03 +0000 (03:04 -0500)
Makefile

index bb881e6366406e9cad296b51b7548c777027a986..be20f2638798a98074bc533fa795b2b88ab493f2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -6,15 +6,20 @@ OBJ = ${SRC:.c=.o}
 
 PREFIX = /usr/local
 
+OS != uname -s
+
+GNUSRC != if [ "${OS}" = "Linux" ]; then \
+       printf "%s" "-D_GNU_SOURCE"; \
+fi
+
 all: ${TARGET}
 
-ust.c: config.h
+${SRC}: config.h
 
 config.h:
-       cp config.def.h config.h
+       cp config.def.h $@
 
 clean:
-       rm -f ${OBJ}
        rm -f *.[oa] ${TARGET}
 
 install:
@@ -25,13 +30,9 @@ install:
 uninstall:
        rm -f ${PREFIX}/bin/${TARGET}
 
-
-CFLAGS = -std=c99 -Wall -pthread -O2
+CFLAGS = -std=c99 -Wall -pthread -O2 ${GNUSRC}
 LDFLAGS = 
 
-# comment out if not on linux
-CFLAGS += -D_GNU_SOURCE
-
 CC = cc
 
 .PHONY: all clean install uninstall