aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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}