Skip to content

Commit

Permalink
improve Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
phillbush committed Jan 13, 2023
1 parent 6a8df3b commit 8f1bb39
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 34 deletions.
34 changes: 23 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,29 +1,41 @@
include config.mk
PROG = xnotify
OBJS = ${PROG:=.o}
SRCS = ${OBJS:.o=.c}

SRCS = ${PROG}.c
OBJS = ${SRCS:.c=.o}
PREFIX ?= /usr/local
MANPREFIX ?= ${PREFIX}/share/man
LOCALINC ?= /usr/local/include
LOCALLIB ?= /usr/local/lib
X11INC ?= /usr/X11R6/include
X11LIB ?= /usr/X11R6/lib

INCS = -I${LOCALINC} -I${X11INC} -I/usr/include/freetype2 -I${X11INC}/freetype2
LIBS = -L${LOCALLIB} -L${X11LIB} -lfontconfig -lXft -lX11 -lXinerama -lImlib2

all: ${PROG}

${PROG}: ${OBJS}
${CC} -o $@ ${OBJS} ${LDFLAGS}
${CC} -o $@ ${OBJS} ${LIBS} ${LDFLAGS}

${PROG}.o: config.h ${PROG}.h
${OBJS}: ${PROG:=.h} config.h

.c.o:
${CC} ${CFLAGS} -c $<
${CC} ${INCS} ${CFLAGS} ${CPPFLAGS} -c $<

tags: ${SRCS}
ctags ${SRCS}

clean:
-rm ${OBJS} ${PROG}
rm -f ${OBJS} ${PROG} ${PROG:=.core} tags

install: all
mkdir -p ${DESTDIR}${PREFIX}/bin
install -m 755 ${PROG} ${DESTDIR}${PREFIX}/bin/${PROG}
mkdir -p ${DESTDIR}${MANPREFIX}/man1
install -m 644 ${PROG}.1 ${DESTDIR}${MANPREFIX}/man1/${PROG}.1
install -m 644 ${PROG:=.1} ${DESTDIR}${MANPREFIX}/man1/${PROG:=.1}

uninstall:
rm -f ${DESTDIR}${PREFIX}/bin/${PROG}
rm -f ${DESTDIR}${MANPREFIX}/man1/${PROG}.1
rm ${DESTDIR}${PREFIX}/bin/${PROG}
rm ${DESTDIR}${MANPREFIX}/man1/${PROG:=.1}

.PHONY: all clean install uninstall
.PHONY: all tags clean install uninstall
23 changes: 0 additions & 23 deletions config.mk

This file was deleted.

0 comments on commit 8f1bb39

Please sign in to comment.