-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
45 lines (34 loc) · 1.03 KB
/
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
37
38
39
40
41
42
43
44
45
OUT = runes
BUILD = build/
SRC = src/
OBJ = $(BUILD)runes.o \
$(BUILD)display.o \
$(BUILD)term.o \
$(BUILD)parser.o \
$(BUILD)screen.o \
$(BUILD)config.o \
$(BUILD)window-xlib.o \
$(BUILD)pty-unix.o
LIBS = cairo cairo-xlib libuv pangocairo
CFLAGS ?= -g -Wall -Wextra -Werror
LDFLAGS ?= -g -Wall -Wextra -Werror
ALLCFLAGS = $(shell pkg-config --cflags $(LIBS)) $(CFLAGS)
ALLLDFLAGS = $(shell pkg-config --libs $(LIBS)) $(LDFLAGS)
MAKEDEPEND = $(CC) $(ALLCFLAGS) -M -MP -MT '$@ $(@:$(BUILD)%.o=$(BUILD).%.d)'
build: $(OUT)
$(OUT): $(OBJ)
$(CC) $(ALLLDFLAGS) -o $@ $^
$(BUILD)%.o: $(SRC)%.c
@mkdir -p $(BUILD)
@$(MAKEDEPEND) -o $(<:$(SRC)%.c=$(BUILD).%.d) $<
$(CC) $(ALLCFLAGS) -c -o $@ $<
$(SRC)screen.c: $(SRC)parser.h
$(SRC)%.c: $(SRC)%.l
$(LEX) -o $@ $<
$(SRC)%.h: $(SRC)%.l
$(LEX) --header-file=$(<:.l=.h) -o /dev/null $<
clean:
rm -f $(OUT) $(OBJ) $(OBJ:$(BUILD)%.o=$(BUILD).%.d)
@rmdir -p $(BUILD) > /dev/null 2>&1
-include $(OBJ:$(BUILD)%.o=$(BUILD).%.d)
.PHONY: build clean