-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (23 loc) · 726 Bytes
/
Makefile
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
TARGET := $(notdir $(patsubst %/,%,$(CURDIR)))
MAKEFILE := $(firstword $(MAKEFILE_LIST))
CC = gcc
LIBS := xtst x11 xi
LINK_LIBS := m # math lib not in pkgconfig
LDFLAGS := $(shell pkg-config --libs $(LIBS)) $(addprefix -l, $(LINK_LIBS))
CFLAGS := $(shell pkg-config --cflags $(LIBS))
SOURCES = $(wildcard *.c)
PREFIX ?= /usr/local
BINPREFIX = $(PREFIX)/bin
INSTALL_TARGET := $(addprefix $(BINPREFIX)/,$(TARGET))
all: $(TARGET)
debug: CFLAGS += -D DEBUG
debug: clean $(TARGET)
$(TARGET): $(SOURCES) $(MAKEFILE)
$(CC) $(CFLAGS) $(LDFLAGS) $(SOURCES) -o $@
install: $(TARGET)
install -m 755 -D --target-directory "$(BINPREFIX)" $<
uninstall:
rm $(INSTALL_TARGET)
clean:
rm $(TARGET)
.PHONY: debug clean all