commit 5f514c5284b3db94ecb4db1fea1e387d66ed4651 parent 2d869ad3f9af08d8fd02fe07f8002a892ccfc2d2 Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Mon, 28 Jul 2014 14:46:43 +0000 add suckless Makefile + VERSION Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org> Diffstat:
M | Makefile | | | 45 | +++++++++++++++++++++++++++++++++++++++------ |
A | config.mk | | | 28 | ++++++++++++++++++++++++++++ |
2 files changed, 67 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile @@ -1,9 +1,42 @@ -build: clean - cc xscreenshot.c -o xscreenshot -lX11 -lpng -Wall -Wextra -pedantic -std=c99 +include config.mk -test: build - ./xscreenshot > screen.png - meh screen.png +NAME = xscreenshot +SRC = xscreenshot.c +OBJ = ${SRC:.c=.o} + +all: xscreenshot + +options: + @echo ${NAME} build options: + @echo "CFLAGS = ${CFLAGS}" + @echo "LDFLAGS = ${LDFLAGS}" + @echo "CC = ${CC}" + +.c.o: + ${CC} -c ${CFLAGS} $< + +${OBJ}: config.mk + +xscreenshot: xscreenshot.o + ${CC} -o $@ xscreenshot.o ${LDFLAGS} clean: - rm -f xscreenshot + rm -f xscreenshot ${OBJ} + +install: all + @echo installing executable file to ${DESTDIR}${PREFIX}/bin + @mkdir -p ${DESTDIR}${PREFIX}/bin + @cp -f xscreenshot ${DESTDIR}${PREFIX}/bin + @chmod 755 ${DESTDIR}${PREFIX}/bin/xscreenshot + @echo installing manual pages to ${DESTDIR}${MANPREFIX}/man1 + @mkdir -p ${DESTDIR}${MANPREFIX}/man1 + @cp -f xscreenshot.1 ${DESTDIR}${MANPREFIX}/man1 + @chmod 644 ${DESTDIR}${MANPREFIX}/man1/xscreenshot.1 + +uninstall: + @echo removing executable file from ${DESTDIR}${PREFIX}/bin + @rm -f ${DESTDIR}${PREFIX}/bin/xscreenshot + @echo removing manual pages from ${DESTDIR}${MANPREFIX}/man1 + @rm -f ${DESTDIR}${MANPREFIX}/man1/xscreenshot.1 + +.PHONY: all options clean dist install uninstall diff --git a/config.mk b/config.mk @@ -0,0 +1,28 @@ +VERSION = 1.0 + +# customize below to fit your system + +# paths +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/share/man + +# includes and libs +INCS = +LIBS = -lc -lpng -lX11 + +# debug +CFLAGS = -O0 -g -std=c99 -Wall -Wextra -pedantic \ + -DVERSION=\"${VERSION}\" -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE +LDFLAGS = ${LIBS} + +# optimized +#CFLAGS = -O2 -std=c99 -DVERSION=\"${VERSION}\" -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE +#LDFLAGS = -s ${LIBS} + +# tcc +#CC = tcc +#CFLAGS = -DVERSION=\"${VERSION}\" -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE +#LDFLAGS = -s ${LIBS} + +# compiler and linker +CC = cc