blob: 4455b14b4cfe1db8ca90d965d3da2cad5c9a4a68 (
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
37
38
39
40
41
42
|
TARGET := meh
TESTTARGET := test/test
SRCFILES := $(wildcard src/*.c)
OBJFILES := $(SRCFILES:%.c=%.o)
DEPFILES := $(OBJFILES:%.o=%.d)
TESTCLEAN := $(TESTTARGET) $(TESTTARGET).d $(TESTTARGET).o
CLEANFILES := $(CLEANFILES) $(DEPFILES) $(OBJFILES) test/test.o test/test.d test/test $(TARGET)
LIBS ?= -lX11 -lXext -ljpeg -lpng -lgif
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
# User configuration
CONFIG ?= ../config
-include configs/$(CONFIG).mk
CFLAGS ?= -O3 -DNDEBUG
meh: $(OBJFILES)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
test: $(TESTTARGET)
./$(TESTTARGET)
test/test: test/test.o $(filter-out src/main.o, $(OBJFILES))
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
-include $(DEPFILES)
%.o: %.c Makefile
$(CC) $(CFLAGS) -MMD -MP -MT "$*.d" -c -o $@ $<
install:
install -Dm 755 meh $(BINDIR)
# Clean
clean:
$(RM) $(CLEANFILES)
.PHONY: clean test
|