Improve Makefile

This commit is contained in:
Utkarsh Verma 2022-08-24 16:34:53 +02:00
parent f1c037037d
commit 098184d0c3
No known key found for this signature in database
GPG Key ID: 817656CF818EFCCC

View File

@ -1,19 +1,21 @@
.POSIX: .POSIX:
PREFIX = /usr/local PREFIX = /usr/local
CC = gcc CFLAGS = -Ofast
LDLIBS = -lX11
BIN = dwmblocks
$(BIN): main.o
$(CC) $^ -o $@ $(LDLIBS)
dwmblocks: main.o
$(CC) main.o -lX11 -Ofast -o dwmblocks
main.o: main.c config.h
$(CC) -Ofast -c main.c
clean: clean:
rm -f *.o *.gch dwmblocks $(RM) *.o $(BIN)
install: dwmblocks
mkdir -p $(DESTDIR)$(PREFIX)/bin install: $(BIN)
cp -f dwmblocks $(DESTDIR)$(PREFIX)/bin install -D -m 755 $(BIN) $(DESTDIR)$(PREFIX)/bin/$(BIN)
chmod 755 $(DESTDIR)$(PREFIX)/bin/dwmblocks
uninstall: uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/dwmblocks $(RM) $(DESTDIR)$(PREFIX)/bin/$(BIN)
.PHONY: clean install uninstall .PHONY: clean install uninstall