Merge pull request #48 from anntnzrb/patch-makefile

Makefile tweaks
These changes are all pretty good. And I'm all for making it easier to build on the BSDs!
This commit is contained in:
torrinfail 2022-01-06 20:08:50 -07:00 committed by GitHub
commit a933ce0d61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 29 additions and 10 deletions

View File

@ -1,17 +1,36 @@
PREFIX ?= /usr/local PREFIX := /usr/local
CC ?= cc CC := cc
LDFLAGS = -lX11 CFLAGS := -pedantic -Wall -Wno-deprecated-declarations -Os
LDFLAGS := -lX11
# FreeBSD (uncomment)
#LDFLAGS += -L/usr/local/lib -I/usr/local/include
# # OpenBSD (uncomment)
#LDFLAGS += -L/usr/X11R6/lib -I/usr/X11R6/include
all: options dwmblocks
options:
@echo dwmblocks build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}"
dwmblocks: dwmblocks.c blocks.def.h blocks.h
${CC} -o dwmblocks dwmblocks.c ${CFLAGS} ${LDFLAGS}
output: dwmblocks.c blocks.def.h blocks.h
${CC} dwmblocks.c $(LDFLAGS) -o dwmblocks
blocks.h: blocks.h:
cp blocks.def.h $@ cp blocks.def.h $@
clean: clean:
rm -f *.o *.gch dwmblocks rm -f *.o *.gch dwmblocks
install: output
mkdir -p $(DESTDIR)$(PREFIX)/bin install: dwmblocks
install -m 0755 dwmblocks $(DESTDIR)$(PREFIX)/bin/dwmblocks mkdir -p ${DESTDIR}${PREFIX}/bin
cp -f dwmblocks ${DESTDIR}${PREFIX}/bin
chmod 755 ${DESTDIR}${PREFIX}/bin/dwmblocks
uninstall: uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/dwmblocks rm -f ${DESTDIR}${PREFIX}/bin/dwmblocks
.PHONY: all options clean install uninstall