commit 36c77931fd8905ad1ca0459fedb209929cb8d596
parent acbc72748d9d2493e4c21c05f58bed4ede84448f
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 2 Sep 2022 11:49:34 +0200
Makefile: simplify and use system flags by default
Diffstat:
2 files changed, 19 insertions(+), 21 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,26 +1,38 @@
-# See LICENSE file for copyright and license details.
.POSIX:
-include config.mk
+VERSION = 1.9
+
+# paths
+PREFIX = /usr/local
+MANPREFIX = $(PREFIX)/share/man
+DOCPREFIX = $(PREFIX)/share/doc
SRC = ii.c
OBJ = $(SRC:.c=.o)
-IICFLAGS = -DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE $(CFLAGS)
+# use system flags.
+II_CFLAGS = $(CFLAGS)
+II_LDFLAGS = $(LDFLAGS)
+
+# on systems which provide strlcpy(3),
+# remove NEED_STRLCPY from CPPFLAGS and
+# remove strlcpy.o from LIBS
+II_CPPFLAGS = $(CPPFLAGS) -DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE -DNEED_STRLCPY
+LIBS = strlcpy.o
all: ii
options:
@echo ii build options:
- @echo "CFLAGS = $(IICFLAGS)"
+ @echo "CFLAGS = $(CFLAGS)"
@echo "LDFLAGS = $(LDFLAGS)"
@echo "CC = $(CC)"
.c.o:
- $(CC) $(IICFLAGS) -c $<
+ $(CC) -c $< $(II_CFLAGS) $(II_CPPFLAGS)
ii: $(OBJ) $(LIBS)
- $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
+ $(CC) -o $@ $(OBJ) $(LIBS) $(II_LDFLAGS)
$(OBJ): arg.h
@@ -40,7 +52,7 @@ uninstall: all
dist: clean
mkdir -p ii-$(VERSION)
cp -R Makefile CHANGES README FAQ LICENSE strlcpy.c arg.h \
- config.mk ii.c ii.1 ii-$(VERSION)
+ ii.c ii.1 ii-$(VERSION)
tar -cf ii-$(VERSION).tar ii-$(VERSION)
gzip ii-$(VERSION).tar
rm -rf ii-$(VERSION)
diff --git a/config.mk b/config.mk
@@ -1,14 +0,0 @@
-# Customize to fit your system
-VERSION = 1.9
-
-# paths
-PREFIX = /usr/local
-MANPREFIX = ${PREFIX}/share/man
-DOCPREFIX = ${PREFIX}/share/doc
-
-# on systems which provide strlcpy(3),
-# remove NEED_STRLCPY from CFLAGS and
-# remove strlcpy.o from LIBS
-CFLAGS = -DNEED_STRLCPY -Os
-LDFLAGS = -s
-LIBS = strlcpy.o