aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-06-08 06:57:51 +0000
committermerakor <cem@ckyln.com>2020-06-08 06:57:51 +0000
commitb5d0b495583e0ea6adfdfcce8a540a621d8c00c5 (patch)
tree6a9a7af0634d7d6fae97fa86068e95300a1a59f6
parent22d2433a2f29379bbe6a4827dfbf438bfacb07a4 (diff)
downloadcpt-b5d0b495583e0ea6adfdfcce8a540a621d8c00c5.tar.gz
Makefile: use config.mk for configuration, Makefile simplifications
FossilOrigin-Name: 96e8a0a741fa029bca1eeeb36a2b8baf92a82022ce982ad30a9eb8e16c7153f4
-rw-r--r--Makefile31
-rw-r--r--config.mk19
2 files changed, 31 insertions, 19 deletions
diff --git a/Makefile b/Makefile
index 3ea8f76..7a6a6a5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,32 +1,24 @@
-PREFIX = /usr/local
-BINDIR = ${PREFIX}/bin
-DOCDIR = ${PREFIX}/share/doc
-KISSDOC = ${DOCDIR}/kiss
-MANPREFIX = ${PREFIX}/share/man
-MAN1 = ${MANPREFIX}/man1
-CC = cc
+# See LICENSE for copyright information
+include config.mk
-all: kiss-stat kiss-readlink
+BIN = bin/kiss-readlink bin/kiss-stat
-kiss-stat: bin/kiss-stat.c
- ${CC} -o kiss-stat bin/kiss-stat.c
+all: ${BIN}
-kiss-readlink: bin/kiss-readlink.c
- ${CC} -o kiss-readlink bin/kiss-readlink.c
+.c:
+ ${CC} ${CFLAGS} ${LDFLAGS} -o $@ $< ${LIBS}
clean:
- rm -f kiss-stat kiss-readlink
+ rm -f ${BIN}
install: all
mkdir -p ${DESTDIR}${BINDIR}
- cp -f kiss kiss-stat kiss-readlink ${DESTDIR}${BINDIR}
- chmod 755 ${DESTDIR}${BINDIR}/kiss \
- ${DESTDIR}${BINDIR}/kiss-stat \
- ${DESTDIR}${BINDIR}/kiss-readlink
+ cp -f kiss ${BIN} ${DESTDIR}${BINDIR}
+ chmod 755 ${DESTDIR}${BINDIR}/kiss
+ for bin in ${BIN}; do chmod 755 ${DESTDIR}${BINDIR}/$${bin##*/}; done
for bin in contrib/* ; do \
cp -f $${bin} ${DESTDIR}${BINDIR}/$${bin##*/}; \
chmod 755 ${DESTDIR}${BINDIR}/$${bin##*/} ; done
-
mkdir -p ${DESTDIR}${MAN1}
for man in man/*.1 ; do cp -f $${man} ${DESTDIR}${MAN1}/$${man##*/}; \
chmod 644 ${DESTDIR}${MAN1}/$${man##*/} ; done
@@ -39,7 +31,8 @@ uninstall:
rm -f ${DESTDIR}${BINDIR}/kiss
rm -f ${DESTDIR}${BINDIR}/kiss-stat
rm -f ${DESTDIR}${BINDIR}/kiss-readlink
- for bin in contrib/* ; do rm -f ${DESTDIR}${BINDIR}/$${bin##*/} ; done
+ for bin in ${BIN}; do rm -f ${DESTDIR}${BINDIR}/$${bin##*/}; done
+ for bin in contrib/*; do rm -f ${DESTDIR}${BINDIR}/$${bin##*/}; done
rm -f ${DESTDIR}${MAN1}/kiss.1 ${DESTDIR}${MAN1}/kiss.1
rm -f ${DESTDIR}${MAN1}/kiss-contrib.1 ${DESTDIR}${MAN1}/kiss-contrib.1
rm -rf ${DESTDIR}${KISSDOC}
diff --git a/config.mk b/config.mk
new file mode 100644
index 0000000..0cc3f5b
--- /dev/null
+++ b/config.mk
@@ -0,0 +1,19 @@
+# See LICENSE for copyright information
+
+# Paths
+PREFIX = /usr/local
+BINDIR = ${PREFIX}/bin
+SHAREDIR = ${PREFIX}/share
+DOCDIR = ${SHAREDIR}/doc
+KISSDOC = ${DOCDIR}/kiss
+MANPREFIX = ${SHAREDIR}/man
+MAN1 = ${MANPREFIX}/man1
+
+# Flags
+CFLAGS = -std=c99 -Wpedantic -Wall -Os
+LDFLAGS = -s -static
+LIBS = -lc
+
+# C compiler and linker
+CC = cc
+LD = ${CC}