summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Marcher <info@nulltime.net>2017-01-07 21:49:10 +0100
committerAaron Marcher <info@nulltime.net>2017-01-07 21:49:10 +0100
commitd1915f0d4d6bae409da7d7cded482650ed2959d8 (patch)
treeeaa542c7044e7fea4c2dc9eeea2ae0274c30265e
parent384791177160a45de6943ad7e1aba5a1948306ed (diff)
saner makefile: cleaner, simpler, suckless
-rw-r--r--Makefile59
-rw-r--r--config.mk4
2 files changed, 13 insertions, 50 deletions
diff --git a/Makefile b/Makefile
index 6cba860..afdbcdf 100644
--- a/Makefile
+++ b/Makefile
@@ -4,58 +4,21 @@ include config.mk
NAME=slstatus
-SRC = ${NAME}.c
-OBJ = ${SRC:.c=.o}
-
-all: options ${NAME}
-
-options:
- @echo ${NAME} build options:
- @echo "CFLAGS = ${CFLAGS}"
- @echo "LDFLAGS = ${LDFLAGS}"
- @echo "CC = ${CC}"
-
-.c.o:
- @echo CC $<
- @${CC} -c ${CFLAGS} $<
-
-${OBJ}: config.h config.mk
-
-config.h:
- @echo creating $@ from config.def.h
- @cp config.def.h $@
-
-${NAME}: ${OBJ}
- @echo CC -o $@
- @${CC} -o $@ ${OBJ} ${LDFLAGS}
+all: ${NAME}
clean:
- @echo cleaning
- @rm -f ${NAME} ${OBJ} ${NAME}.tar.gz
-
-dist: clean
- @echo creating dist tarball
- @mkdir -p ${NAME}
- @cp -R Makefile config.mk LICENSE \
- ${SRC} ${NAME}
- @tar -cf ${NAME}.tar ${NAME}
- @gzip ${NAME}.tar
- @rm -rf ${NAME}
+ rm -f ${NAME}
install: all
- @echo installing executable file to ${DESTDIR}${PREFIX}/bin
- @mkdir -p ${DESTDIR}${PREFIX}/bin
- @cp -f ${NAME} ${DESTDIR}${PREFIX}/bin
- @chmod 755 ${DESTDIR}${PREFIX}/bin/${NAME}
- @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
- @mkdir -p ${DESTDIR}${MANPREFIX}/man1
- @cp -f ${NAME}.1 ${DESTDIR}${MANPREFIX}/man1
- @chmod 644 ${DESTDIR}${MANPREFIX}/man1/${NAME}.1
+ mkdir -p ${DESTDIR}${PREFIX}/bin
+ cp -f ${NAME} ${DESTDIR}${PREFIX}/bin
+ chmod 755 ${DESTDIR}${PREFIX}/bin/${NAME}
+ mkdir -p ${DESTDIR}${MANPREFIX}/man1
+ cp -f ${NAME}.1 ${DESTDIR}${MANPREFIX}/man1
+ chmod 644 ${DESTDIR}${MANPREFIX}/man1/${NAME}.1
uninstall:
- @echo removing executable file from ${DESTDIR}${PREFIX}/bin
- @rm -f ${DESTDIR}${PREFIX}/bin/${NAME}
- @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
- @rm -f ${DESTDIR}${MANPREFIX}/man1/${NAME}.1
+ rm -f ${DESTDIR}${PREFIX}/bin/${NAME}
+ rm -f ${DESTDIR}${MANPREFIX}/man1/${NAME}.1
-.PHONY: all options clean dist install uninstall
+.PHONY: all clean install uninstall
diff --git a/config.mk b/config.mk
index 36b129a..7196190 100644
--- a/config.mk
+++ b/config.mk
@@ -6,10 +6,10 @@ MANPREFIX = ${PREFIX}/share/man
X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib
-INCS = -I. -I/usr/include -I${X11INC}
+INCS = -I/usr/include -I${X11INC}
LIBS = -L/usr/lib -lc -L${X11LIB} -lX11
-CPPFLAGS = -DVERSION=\"${VERSION}\" -D_GNU_SOURCE
+CPPFLAGS = -D_GNU_SOURCE
# -Wno-unused-function for routines not activated by user
CFLAGS = -std=c99 -pedantic -Wno-unused-function -Wall -Wextra -Os ${INCS} ${CPPFLAGS}
LDFLAGS = ${LIBS}