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
1 changed files with 13 additions and 11 deletions

View File

@ -1,19 +1,21 @@
.POSIX:
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:
rm -f *.o *.gch dwmblocks
install: dwmblocks
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f dwmblocks $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/dwmblocks
$(RM) *.o $(BIN)
install: $(BIN)
install -D -m 755 $(BIN) $(DESTDIR)$(PREFIX)/bin/$(BIN)
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/dwmblocks
$(RM) $(DESTDIR)$(PREFIX)/bin/$(BIN)
.PHONY: clean install uninstall