-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile.common
187 lines (158 loc) · 6.2 KB
/
Makefile.common
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# Main common targets: clean build unit test
# "package" must be defined in platform dependent makefiles
ifneq ($(INSIDE_EMACS),)
JREGROUTPUT = -noansi
else
UNITOUTPUT ?= -c
endif
# VERSION = `venum alan -print "\\$$v.\\$$r\\$$s\\$$c" | tr -d '\n\r'`
#VERSION = `awk 'NR > 3; NR == 7 {exit}' alan.version | awk '{v[NR] = $$0}; END { printf "%s.%s%s%s", v[1], v[2], v[4], v[3]}'`
VERSION := $(shell cat NEXTRELEASE)
# PLATFORM will be part of package names
PLATFORM ?= "Make variable PLATFORM needs to be set by platform specific Makefile"
PACKAGENAME = alan$(VERSION)$(BUILDVERSION).$(PLATFORM)
.PHONY: clean
clean:
-$(MAKE) -C compiler clean
-$(MAKE) -C interpreter clean
-$(MAKE) -C converter clean
-rm -f alan3*.tgz
-rm -rf coverage.info coverage-report
.PHONY: unit
unit:
$(MAKE) -C compiler UNITOUTPUT="$(UNITOUTPUT)" unit
$(MAKE) -C interpreter UNITOUTPUT="$(UNITOUTPUT)" unit
$(MAKE) -C converter UNITOUTPUT="$(UNITOUTPUT)" unit
.PHONY: build
build:
$(MAKE) -C compiler BUILDNUMBER=$(BUILDNUMBER) build
$(MAKE) -C interpreter BUILDNUMBER=$(BUILDNUMBER) build
$(MAKE) -C converter BUILDNUMBER=$(BUILDNUMBER) build
.PHONY: test
test:
$(MAKE) -e -C compiler JREGROUTPUT=$(JREGROUTPUT) test
$(MAKE) -e -C interpreter JREGROUTPUT=$(JREGROUTPUT) test
$(MAKE) -e -C converter JREGROUTPUT=$(JREGROUTPUT) test
.PHONY: cross
cross: PLATFORM = win32.i686
cross:
$(MAKE) -C compiler BUILDNUMBER=$(BUILDNUMBER) cross
$(MAKE) -C interpreter BUILDNUMBER=$(BUILDNUMBER) cross
$(MAKE) -C converter BUILDNUMBER=$(BUILDNUMBER) cross
# The ci target is designed to be run in Linux with everything
# available to create command line SDK for Linux and Windows, as well
# as WinArun, WinAlan and packages and installation scripts. So here
# we explicitly build necessary output by setting required variables
# and paths for compilation as per the Docker container
# alanif/linux-ci as specified in the dockers/linux-ci/Dockerfile.
export JREGROUTPUT UNITOUTPUT
ci: JREGROUTPUT = -xml
ci: UNITOUTPUT = --xml TEST
.PHONY: ci
ci:
$(MAKE) -e all
$(MAKE) package
$(MAKE) cross
$(MAKE) cross-package
$(MAKE) -C interpreter WINARUN_ENABLED=true WINGLK_ROOT=$(HOME)/WindowsGlk winarun
$(MAKE) -C compiler WINALAN_ENABLED=true winalan
$(MAKE) WINGLK_ROOT=$(HOME)/WindowsGlk setup
# TODO: We should also build gargoyle slot-in interpreter for Linux and Windows
# $(MAKE) -C interpreter gararun
.PHONY: ci-upload
ci-upload:
bin/alanupload $(PACKAGE) snapshots/$(BUILDNAME)
bin/alanupload $(CROSS_PACKAGE) snapshots/$(BUILDNAME)
bin/alanupload $(WINARUN_PACKAGE) snapshots/$(BUILDNAME)
bin/alanupload $(WINALAN_PACKAGE) snapshots/$(BUILDNAME)
#bin/alanupload $(GARARUN_PACKAGE) snapshots/$(BUILDNAME)
#bin/alanupload $(GARARUN_CROSS_PACKAGE) snapshots/$(BUILDNAME)
.PHONY:
coverage: COVERAGE=--coverage
coverage:
$(MAKE) -C compiler COVERAGE=$(COVERAGE) unit
$(MAKE) -C interpreter COVERAGE=$(COVERAGE) unit
$(MAKE) -C compiler COVERAGE=$(COVERAGE) alan
$(MAKE) -C interpreter COVERAGE=$(COVERAGE) arun
$(MAKE) -C compiler test
$(MAKE) -C interpreter test
$(MAKE) coverage-report
.PHONY:coverage-report
coverage-report:
lcov -q -c -d . --exclude \*/usr/\* -o coverage.info
@# Re-create separate gcov files from total.info for Emacs cov-mode
@# with coverage in the fringe area and auto-update. Nice!
@# See https://github.com/AdamNiederer/cov
if command -v info2gcov > /dev/null 2>&1 ; then \
info2gcov -q coverage.info ; \
fi
genhtml -q -o coverage-report coverage.info
###########################################################
# Regularly you should run this to ensure that story/game
# files created on other platforms can be run on this.
# It also creates a new such game/story file from this
# platform that you should check in.
.PHONY: platform-check
platform-check:
bin/jregr -bin bin -dir regression/platforms
# Generate a new .a3c file for this platform that can be committed
# so that it can be tested on other platforms
cd regression/platforms; cp platforms.alan $(OS).alan; ../../bin/alan $(OS); rm $(OS).alan
###########################################################
# Snapshot boiler plate for non-major platforms
# specifics in Makefile.<platform> where 'snapshot-build'
# and 'snapshot-upload' needs to be defined.
#
snapshot: buildnumbers snapshot-build snapshot-upload
##################################################
# Build designations:
# BUILDNUMBER is just the number
# BUILDVERSION includes a dash, if no-empty, so can be used with $(VERSION)$(BUILDVERSION)
# BUILDNAME is "Build"$(BUILDNUMBER), e.g. "Build1667"
#
# You can call 'buildnumbers' to pick up the latest build from Jenkins, you can also
# set a BUILDNUMBER and then call it which will set the other dependent values correctly
# Jenkins sets BUILD_NUMBER so use that if available
ifneq ($(BUILD_NUMBER),)
BUILDNUMBER := $(BUILD_NUMBER)
BUILDVERSION := -$(BUILDNUMBER)
BUILDNAME := Build$(BUILDNUMBER)
endif
# If there is a file with BUILDNUMBER, use that
ifneq ($(wildcard ./BUILDNUMBER),)
BUILDNUMBER := `cat BUILDNUMBER | tr -d '\n'`
BUILDVERSION := -$(BUILDNUMBER)
BUILDNAME := Build$(BUILDNUMBER)
endif
.PHONY: buildnumbers
buildnumbers: buildnumber
$(eval BUILDVERSION := -$(BUILDNUMBER))
$(eval BUILDNAME := Build$(BUILDNUMBER))
@echo BUILDNUMBER = $(BUILDNUMBER)
@echo BUILDVERSION = $(BUILDVERSION)
@echo BUILDNAME = $(BUILDNAME)
buildnumber:
ifeq ($(BUILDNUMBER),)
@echo "Getting BUILDNUMBER from Jenkins (should only happen when not building on Jenkins@ci.alanif.se)"
$(eval BUILDNUMBER := $(shell wget -q -O- 'https://ci.alanif.se/job/Alan/api/xml?xpath=*/lastSuccessfulBuild/number' | $(XPATH) 'number/text()'))
else
@echo "Have BUILDNUMBER file ($(BUILDNUMBER)), not getting from Jenkins"
endif
# Need for packaging
games/adventv3/adventV3.a3c: games/adventv3/adventV3.alan bin/alan
cd games/adventv3; ../../bin/alan adventV3
#######################################################################
# Check to see if we are running on ThoNi's machine, if so include
# special rules
ifeq ($(shell uname -n), thoni64)
-include Makefile.thoni
endif
# For debugging
.PHONY: v
v:
@echo VERSION = $(VERSION)
@echo BUILDNUMBER = $(BUILDNUMBER)
@echo BUILDVERSION = $(BUILDVERSION)
@echo BUILDNAME = $(BUILDNAME)
@echo PACKAGE=$(PACKAGE)
@echo PLATFORM=$(PLATFORM)