]> git.armaanb.net Git - stagit.git/commitdiff
add Makefile and config.mk
authorHiltjo Posthuma <hiltjo@codemadness.org>
Sat, 5 Dec 2015 20:07:52 +0000 (21:07 +0100)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Sat, 5 Dec 2015 20:07:52 +0000 (21:07 +0100)
Makefile [new file with mode: 0644]
config.mk [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..0c5ebd5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,72 @@
+include config.mk
+
+NAME = urmoms
+VERSION = 0.1
+SRC = \
+       urmoms.c
+BIN = \
+       urmoms
+MAN1 = \
+       urmoms.1
+DOC = \
+       LICENSE\
+       README\
+       TODO
+HDR = 
+
+OBJ = ${SRC:.c=.o}
+
+all: $(BIN)
+
+.c.o:
+       ${CC} -c ${CFLAGS} $<
+
+dist: $(BIN)
+       rm -rf release/${VERSION}
+       mkdir -p release/${VERSION}
+       cp -f ${MAN1} ${HDR} ${SCRIPTS} ${SRC} ${COMPATSRC} ${DOC} \
+               Makefile config.mk \
+               logo.png style.css \
+               release/${VERSION}/
+       # make tarball
+       rm -f urmoms-${VERSION}.tar.gz
+       (cd release/${VERSION}; \
+       tar -czf ../../urmoms-${VERSION}.tar.gz .)
+
+${OBJ}: config.mk ${HDR}
+
+urmoms: urmoms.o
+       ${CC} -o $@ urmoms.o ${LDFLAGS}
+
+clean:
+       rm -f ${BIN} ${OBJ}
+
+install: all
+       # installing executable files.
+       mkdir -p ${DESTDIR}${PREFIX}/bin
+       cp -f ${BIN} ${SCRIPTS} ${DESTDIR}${PREFIX}/bin
+       for f in $(BIN) $(SCRIPTS); do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done
+       # installing example files.
+       mkdir -p ${DESTDIR}${PREFIX}/share/${NAME}
+       cp -f style.css\
+               logo.png\
+               README\
+               ${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 and scripts.
+       for f in $(BIN) $(SCRIPTS); do rm -f ${DESTDIR}${PREFIX}/bin/$$f; done
+       # removing example files.
+       rm -f \
+               ${DESTDIR}${PREFIX}/share/${NAME}/style.css\
+               ${DESTDIR}${PREFIX}/share/${NAME}/logo.png\
+               ${DESTDIR}${PREFIX}/share/${NAME}/README
+       -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
diff --git a/config.mk b/config.mk
new file mode 100644 (file)
index 0000000..c019e51
--- /dev/null
+++ b/config.mk
@@ -0,0 +1,30 @@
+# customize below to fit your system
+
+# paths
+PREFIX = /usr/local
+MANPREFIX = ${PREFIX}/share/man
+
+GITINC = /usr/local/include
+GITLIB = /usr/local/lib
+
+# includes and libs
+INCS = -I${GITINC}
+LIBS = -L${GITLIB} -lgit2 -lc
+
+# debug
+CFLAGS = -fstack-protector-all -O0 -g -std=c99 -Wall -Wextra -pedantic \
+       -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -D_BSD_SOURCE ${INCS}
+LDFLAGS = ${LIBS}
+
+# optimized
+#CFLAGS = -O2 -std=c99 \
+#      -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -D_BSD_SOURCE ${INCS}
+#LDFLAGS = -s ${LIBS}
+
+# optimized static
+#CFLAGS = -static -O2 -std=c99 \
+#      -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -D_BSD_SOURCE ${INCS}
+#LDFLAGS = -static -s ${LIBS}
+
+# compiler and linker
+#CC = cc