-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
51 lines (40 loc) · 1.12 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
# Targets:
#
# - default builds 'targets' and 'tags'
# - all builds 'targets', 'optimized', and 'tags'
# - targets builds cxxforth executable
# - optimized builds cxxforth with -O3 and runtime checks disabled
# - clean removes build products
#
# On a 64-bit platform, invoke make like this to build a 32-bit Forth:
#
# CMAKEFLAGS=-DCXXFORTH_32BIT=ON make all
CMAKE ?= cmake
MKDIR ?= mkdir
RM ?= rm
CD ?= cd
CTAGS ?= ctags
BUILDDIR ?= build
OPTIMIZEDDIR ?= build_optimized
.PHONY: default
default: targets
.PHONY: all
all: targets optimized tags
.PHONY: targets
targets: $(BUILDDIR)/Makefile
$(MAKE) -C $(BUILDDIR)
$(BUILDDIR)/Makefile: CMakeLists.txt Makefile
$(MKDIR) -p $(BUILDDIR)
cd $(BUILDDIR) && $(CMAKE) $(CMAKEFLAGS) ..
.PHONY: optimized
optimized: $(OPTIMIZEDDIR)/Makefile
$(MAKE) -C $(OPTIMIZEDDIR)
$(OPTIMIZEDDIR)/Makefile: CMakeLists.txt Makefile
$(MKDIR) -p $(OPTIMIZEDDIR)
cd $(OPTIMIZEDDIR) && $(CMAKE) $(CMAKEFLAGS) -DCXXFORTH_OPTIMIZED=ON -DCXXFORTH_SKIP_RUNTIME_CHECKS=ON ..
tags: cxxforth.cpp cxxforth.h
$(CTAGS) $^
.PHONY: clean
clean:
- $(RM) -rf $(BUILDDIR)
- $(RM) -rf $(OPTIMIZEDDIR)