-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (35 loc) · 1.04 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
46
47
48
49
50
51
#CONFIG_SDL = y
LD := $(CC)
TANGLE := ctangle
V = @
OBJDIR := obj
LDFLAGS += $$(pkg-config --libs x11 xft)
CFLAGS += -g --std=c99 -Wall -Wextra -I. $$(pkg-config --cflags x11 xft)
SRCFILES := unicode.c evnt.c x11.c buf.c edit.c win.c exec.c vicmd.w main.c
ifeq ($(CONFIG_SDL),y)
FONT_FILE = $(shell scripts/fontfinder.sh)
LDFLAGS += $$(sdl2-config --libs) -lSDL2_ttf
CFLAGS += $$(sdl2-config --cflags) -DCONFIG_SDL -DFONT_FILE=\"$(FONT_FILE)\"
SRCFILES += sdl.c
endif
OBJFILES := $(patsubst %.w, $(OBJDIR)/%.o, $(SRCFILES:%.c=$(OBJDIR)/%.o))
all: $(OBJDIR)/edit
# Build rules
clean:
rm -fr $(OBJDIR)
$(OBJDIR)/.deps: $(OBJDIR) $(SRCFILES:%.w=$(OBJDIR)/%.c) $(wildcard *.h)
@$(CC) -MM $(CFLAGS) $(OBJDIR)/*.c *.c \
| sed -e "s,^.*:,$(OBJDIR)/&," > $@
-include $(OBJDIR)/.deps
%.o $(OBJDIR)/%.o: %.c
@echo cc $<
$(V)$(CC) $(CFLAGS) -c -o $@ $<
$(OBJDIR)/%.c: %.w
@echo tangle $<
$(V)$(TANGLE) $< - $@
$(OBJDIR)/edit: $(OBJDIR) $(OBJFILES)
@echo ld $@
$(V)$(LD) -o $@ $(OBJFILES) $(LDFLAGS)
$(OBJDIR):
@mkdir -p $@
.PHONY: all clean