add proper initial Makefile - saait - the most boring static page generator
HTML git clone git://git.codemadness.org/saait
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit bcf4cf9414e124feef6d1837d9b67c500214ddee
DIR parent b745b567b2a00df14039e634f05eb6fa168c6039
HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 4 Aug 2017 15:39:47 +0200
add proper initial Makefile
Diffstat:
M Makefile | 77 ++++++++++++++++++++++++++++---
A config.mk | 32 +++++++++++++++++++++++++++++++
2 files changed, 103 insertions(+), 6 deletions(-)
---
DIR diff --git a/Makefile b/Makefile
@@ -1,9 +1,74 @@
-test: build
- mkdir -p output
- ./saait `ls -1r pages/*.cfg`
+include config.mk
-build: clean
- cc -g -ggdb saait.c -o saait -Wall -std=c99 -Wextra -pedantic -D_DEFAULT_SOURCE
+NAME = saait
+VERSION = 0.1
+SRC = \
+ saait.c
+BIN = \
+ saait
+MAN1 = \
+ saait.1
+DOC = \
+ LICENSE\
+ README\
+ TODO
+
+OBJ = ${SRC:.c=.o}
+
+all: ${BIN}
+
+.o:
+ ${CC} ${LDFLAGS} -o $@ ${LIBS}
+
+.c.o:
+ ${CC} -c ${CFLAGS} ${CPPFLAGS} -o $@ -c $<
+
+dist:
+ rm -rf ${NAME}-${VERSION}
+ mkdir -p ${NAME}-${VERSION}
+ cp -f ${MAN1} ${HDR} ${SRC} ${DOC} \
+ Makefile config.mk \
+ ${NAME}-${VERSION}
+ # make tarball
+ tar -cf - ${NAME}-${VERSION} | \
+ gzip -c > ${NAME}-${VERSION}.tar.gz
+ rm -rf ${NAME}-${VERSION}
+
+${OBJ}: config.mk ${HDR}
+
+saait: saait.o
+ ${CC} -o $@ saait.o ${LDFLAGS}
clean:
- rm -f saait
+ rm -f ${BIN} ${OBJ} ${NAME}-${VERSION}.tar.gz
+
+install: all
+ # installing executable files.
+ mkdir -p ${DESTDIR}${PREFIX}/bin
+ cp -f ${BIN} ${DESTDIR}${PREFIX}/bin
+ for f in ${BIN}; do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done
+ # installing example files.
+ mkdir -p ${DESTDIR}${PREFIX}/share/${NAME}
+ cp -f \
+ README\
+ style.css\
+ config.cfg\
+ ${DESTDIR}${PREFIX}/share/${NAME}
+ # installing manual pages.
+ mkdir -p ${DESTDIR}${MANPREFIX}/man1
+ cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1
+ for m in ${MAN1}; do chmod 644 ${DESTDIR}${MANPREFIX}/man1/$$m; done
+
+uninstall:
+ # removing executable files.
+ for f in ${BIN}; do rm -f ${DESTDIR}${PREFIX}/bin/$$f; done
+ # removing example files.
+ rm -f \
+ ${DESTDIR}${PREFIX}/share/${NAME}/README\
+ ${DESTDIR}${PREFIX}/share/${NAME}/style.css\
+ ${DESTDIR}${PREFIX}/share/${NAME}/config.cfg
+ -rmdir ${DESTDIR}${PREFIX}/share/${NAME}
+ # removing manual pages.
+ for m in ${MAN1}; do rm -f ${DESTDIR}${MANPREFIX}/man1/$$m; done
+
+.PHONY: all clean dist install uninstall
DIR diff --git a/config.mk b/config.mk
@@ -0,0 +1,32 @@
+# customize below to fit your system
+
+# paths
+PREFIX = /usr/local
+MANPREFIX = ${PREFIX}/man
+
+# compiler and linker
+#CC = cc
+
+GITINC = /usr/local/include
+GITLIB = /usr/local/lib
+
+# includes and libs
+INCS =
+LIBS =
+
+# debug
+#CFLAGS = -fstack-protector-all -O0 -g -std=c99 -Wall -Wextra -pedantic ${INCS}
+#LDFLAGS = ${LIBS}
+
+# optimized
+CFLAGS = -O2 -std=c99 ${INCS}
+LDFLAGS = -s ${LIBS}
+
+# optimized static
+#CFLAGS = -static -O2 -std=c99 ${INCS}
+#LDFLAGS = -static -s ${LIBS}
+
+CPPFLAGS = -D_DEFAULT_SOURCE ${INCS}
+
+# OpenBSD 5.9+: use pledge(2)
+#CPPFLAGS += -DUSE_PLEDGE