-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (36 loc) · 998 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
EXE = glangc
SRCDIR = glangc
BINDIR = bin
RM = rm
MKDIR = mkdir
TC = touch
FLAGS := -error-pos-style:unix
# =================== variables ===================
Y = \033[0;33m
P = \033[1;35m
G = \033[1;30m
N = \033[0m
COMMA := ,
EMPTY :=
SPACE := $(EMPTY) $(EMPTY)
SOURCES := $(shell find $(SRCDIR) -name "*.odin")
PROFILE := $(if $(release),release,debug)
# ==================== targets ====================
$(EXE): $(BINDIR)/$(EXE)
ifneq "$(shell cat $(BINDIR)/profile)" "$(PROFILE)"
.PHONY: $(BINDIR)/$(EXE)
endif
$(BINDIR)/$(EXE): $(SOURCES) | makedirs
@printf "$(Y)[$(EXE)]$(N) "
odin build $(SRCDIR) $(FLAGS) -out:$@ $(if $(release),,-debug)
@echo $(PROFILE) > $(BINDIR)/profile
# ===================== tools =====================
test: glangc
$(eval _args=$(subst $(COMMA),$(SPACE),$(args)))
$(eval _cmd=$(BINDIR)/glangc -verbose test/test.gl -out:bin/test.txt $(_args))
@printf "$(G)# $(_cmd)$(N)\n"
@$(_cmd)
makedirs:
@$(MKDIR) -p $(BINDIR)
clean:
@$(RM) -rf $(BINDIR)