saner makefile: cleaner, simpler, suckless
This commit is contained in:
parent
3847911771
commit
d1915f0d4d
2 changed files with 13 additions and 50 deletions
59
Makefile
59
Makefile
|
@ -4,58 +4,21 @@ include config.mk
|
||||||
|
|
||||||
NAME=slstatus
|
NAME=slstatus
|
||||||
|
|
||||||
SRC = ${NAME}.c
|
all: ${NAME}
|
||||||
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}
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo cleaning
|
rm -f ${NAME}
|
||||||
@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}
|
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
@echo installing executable file to ${DESTDIR}${PREFIX}/bin
|
mkdir -p ${DESTDIR}${PREFIX}/bin
|
||||||
@mkdir -p ${DESTDIR}${PREFIX}/bin
|
cp -f ${NAME} ${DESTDIR}${PREFIX}/bin
|
||||||
@cp -f ${NAME} ${DESTDIR}${PREFIX}/bin
|
chmod 755 ${DESTDIR}${PREFIX}/bin/${NAME}
|
||||||
@chmod 755 ${DESTDIR}${PREFIX}/bin/${NAME}
|
mkdir -p ${DESTDIR}${MANPREFIX}/man1
|
||||||
@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1
|
cp -f ${NAME}.1 ${DESTDIR}${MANPREFIX}/man1
|
||||||
@mkdir -p ${DESTDIR}${MANPREFIX}/man1
|
chmod 644 ${DESTDIR}${MANPREFIX}/man1/${NAME}.1
|
||||||
@cp -f ${NAME}.1 ${DESTDIR}${MANPREFIX}/man1
|
|
||||||
@chmod 644 ${DESTDIR}${MANPREFIX}/man1/${NAME}.1
|
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
@echo removing executable file from ${DESTDIR}${PREFIX}/bin
|
rm -f ${DESTDIR}${PREFIX}/bin/${NAME}
|
||||||
@rm -f ${DESTDIR}${PREFIX}/bin/${NAME}
|
rm -f ${DESTDIR}${MANPREFIX}/man1/${NAME}.1
|
||||||
@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1
|
|
||||||
@rm -f ${DESTDIR}${MANPREFIX}/man1/${NAME}.1
|
|
||||||
|
|
||||||
.PHONY: all options clean dist install uninstall
|
.PHONY: all clean install uninstall
|
||||||
|
|
|
@ -6,10 +6,10 @@ MANPREFIX = ${PREFIX}/share/man
|
||||||
X11INC = /usr/X11R6/include
|
X11INC = /usr/X11R6/include
|
||||||
X11LIB = /usr/X11R6/lib
|
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
|
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
|
# -Wno-unused-function for routines not activated by user
|
||||||
CFLAGS = -std=c99 -pedantic -Wno-unused-function -Wall -Wextra -Os ${INCS} ${CPPFLAGS}
|
CFLAGS = -std=c99 -pedantic -Wno-unused-function -Wall -Wextra -Os ${INCS} ${CPPFLAGS}
|
||||||
LDFLAGS = ${LIBS}
|
LDFLAGS = ${LIBS}
|
||||||
|
|
Loading…
Reference in a new issue