Skip to content

Commit

Permalink
Fix Makefile
Browse files Browse the repository at this point in the history
- Respect system CC, CFLAGS, LDFLAGS if these are set
- Respect DESTDIR during installation
  • Loading branch information
AMDmi3 committed Mar 17, 2021
1 parent 8ccfc58 commit 4c7f1c3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
PROJECT = sdwmbar
CC = cc
CC ?= cc

PREFIX = /usr/local
XPREFIX = /usr/local
PREFIX ?= /usr/local
XPREFIX ?= /usr/local

OS != uname
.if ${OS} == OpenBSD
XPREFIX = /usr/X11R6
XPREFIX ?= /usr/X11R6
.endif

INCS = -I${XPREFIX}/include
LINKS = -L${XPREFIX}/lib -lX11
CFLAGS = -std=c99 -pedantic -Wall -Werror ${INCS} ${LINKS}
CFLAGS += -std=c99 -pedantic -Wall -Werror ${INCS} ${LINKS}

all:
cc ${PROJECT}.c ${CFLAGS} -o ${PROJECT}
${CC} ${PROJECT}.c ${CFLAGS} ${LDFLAGS} -o ${PROJECT}

debug:
cc ${PROJECT}.c ${CFLAGS} -g -o ${PROJECT}
${CC} ${PROJECT}.c ${CFLAGS} ${LDFLAGS} -g -o ${PROJECT}

clean:
rm -rf ${PROJECT}

install:
install ${PROJECT} ${PREFIX}/bin/${PROJECT}
install ${PROJECT} ${DESTDIR}${PREFIX}/bin/${PROJECT}

uninstall:
rm -rf ${PREFIX}/bin/${PROJECT}

0 comments on commit 4c7f1c3

Please sign in to comment.