CC? = cc MAIN = dwmclock SRC = dwmclock.c OBJ = $(SRC:.c=.o) CFLAGS := -std=c99 -Wall -Wextra -pedantic -Os $(shell pkg-config --cflags x11) $(CFLAGS) LDFLAGS := $(shell pkg-config --libs x11) $(LDFLAGS) # install in /usr/local/bin DESTDIR ?= / PREFIX ?= /usr/local # install in ~/.local/bin #DESTDIR ?= ~ #PREFIX ?= /.local include config.mk all: $(SRC) $(MAIN) $(MAIN): $(OBJ) $(CC) $(LDFLAGS) -o $@ $(OBJ) .c.o: $(CC) -c $(CFLAGS) $< -o $@ -O2 clean: -rm -f $(MAIN) $(OBJ) install: $(MAIN) mkdir -p $(DESTDIR)$(PREFIX)/bin cp $(MAIN) $(DESTDIR)$(PREFIX)/bin/$(MAIN) uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/$(MAIN) .PHONY: all clean install uninstall