aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 513398018f570aa77ae79b200dee137cedfe6539 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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