commit 0e5be464cdcab2d17d9f9ab5cf75015bd18c1632
parent edb683070a46f17242618569dacff02b6075115e
Author: Quentin Rameau <quinq@fifth.space>
Date: Wed, 20 Jul 2022 20:07:55 +0200
Makefile: Add system compilation flags
Diffstat:
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
@@ -14,7 +14,7 @@ config.h:
cp config.def.h config.h
$(BIN): $(OBJ)
- $(CC) $(OBJ) $(LDFLAGS) $(IOLIBS) $(LIBS) -o $@
+ $(CC) $(SACCLDFLAGS) -o $@ $(OBJ) $(IOLIBS) $(LIBS)
$(OBJ): config.h config.mk common.h io.h
@@ -32,8 +32,13 @@ uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN) $(DESTDIR)$(MANDIR)/$(MAN)
# Stock FLAGS
-SACCCFLAGS = -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_GNU_SOURCE \
- -DVERSION=\"$(GETVER)\" $(IOCFLAGS) $(CFLAGS)
+SACCCFLAGS = $(OSCFLAGS) \
+ -DVERSION=\"$(GETVER)\" \
+ $(IOCFLAGS) \
+ $(CFLAGS) \
+
+SACCLDFLAGS = $(OSLDFLAGS) \
+ $(LDFLAGS) \
.c.o:
$(CC) $(SACCCFLAGS) -c $<
diff --git a/config.mk b/config.mk
@@ -22,6 +22,14 @@ IO = tls
IOLIBS = -ltls
IOCFLAGS = -DUSE_TLS
-# Define NEED_ASPRINTF and/or NEED_STRCASESTR in your cflags if your system does
-# not provide asprintf() or strcasestr(), respectively.
-#CFLAGS = -DNEED_ASPRINTF -DNEED_STRCASESTR
+# OS compilation flags are used to expose the system interfaces
+# Linux, OpenBSD
+OSCFLAGS = -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_GNU_SOURCE
+OSLDFLAGS =
+# FreeBSD
+#OSCFLAGS = -I/usr/local/include
+#OSLDFLAGS = -L/usr/local/lib
+
+# Define NEED_ASPRINTF and/or NEED_STRCASESTR in your OS compilation flags
+# if your system does not provide asprintf() or strcasestr(), respectively.
+#OSCFLAGS = -DNEED_ASPRINTF -DNEED_STRCASESTR