summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2019-01-25 13:51:30 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2019-01-25 13:51:30 +0100
commitde903c0e8a4e79faec8f73a4c27a432282e8a329 (patch)
tree1a92b3377eb431656c19916bdbfef3a68bd92f5d
parente46d200e0cb2ffb79a7d542f65809e1bb14c445c (diff)
Makefile: add POSIX target, respect (packaging) system CFLAGS/LDFLAGS
this also makes packaging slightly simpler.
-rw-r--r--Makefile6
-rw-r--r--config.mk20
2 files changed, 16 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 3c09fee..382c2a5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,5 @@
+.POSIX:
+
include config.mk
NAME = sfeed
@@ -58,10 +60,10 @@ OBJ = ${SRC:.c=.o} ${LIBXMLOBJ} ${LIBUTILOBJ}
${OBJ}: config.mk ${HDR}
.o:
- ${CC} ${LDFLAGS} -o $@ $< ${LIB}
+ ${CC} ${SFEED_LDFLAGS} -o $@ $< ${LIB}
.c.o:
- ${CC} ${CFLAGS} ${CPPFLAGS} -o $@ -c $<
+ ${CC} ${SFEED_CFLAGS} ${SFEED_CPPFLAGS} -o $@ -c $<
${LIBUTIL}: ${LIBUTILOBJ}
${AR} rc $@ $?
diff --git a/config.mk b/config.mk
index 79af98d..673cfd8 100644
--- a/config.mk
+++ b/config.mk
@@ -9,16 +9,20 @@ CC = cc
AR = ar
RANLIB = ranlib
+# use system flags.
+SFEED_CFLAGS = ${CFLAGS}
+SFEED_LDFLAGS = ${LDFLAGS}
+SFEED_CPPFLAGS = -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -D_BSD_SOURCE
+
# debug
-#CFLAGS = -fstack-protector-all -O0 -g -std=c99 -Wall -Wextra -pedantic
-#LDFLAGS =
+#SFEED_CFLAGS = -fstack-protector-all -O0 -g -std=c99 -Wall -Wextra -pedantic \
+# -Wno-unused-parameter
+#SFEED_LDFLAGS =
# optimized
-CFLAGS = -O2 -std=c99
-LDFLAGS = -s
+#SFEED_CFLAGS = -O2 -std=c99
+#SFEED_LDFLAGS = -s
# optimized static
-#CFLAGS = -static -O2 -std=c99
-#LDFLAGS = -static -s
-
-CPPFLAGS = -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -D_BSD_SOURCE
+#SFEED_CFLAGS = -static -O2 -std=c99
+#SFEED_LDFLAGS = -static -s