-
Notifications
You must be signed in to change notification settings - Fork 58
/
Makefile
249 lines (225 loc) · 10.1 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
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
.PHONY: checkallvars checkvars clean zcadenv zcadelectrotechenv version zcad zcadelectrotech afterzcadelectrotechbuild cleanzcad cleanzcadelectrotech installpkgstolaz zcadelectrotechpdfuseguide rmpkgslibs tests
default: cleanzcad
ZCVERSION:=$(shell git describe --tags)
QZCVERSION:='$(ZCVERSION)'
OSDETECT:=
ifeq ($(OS),Windows_NT)
OSDETECT:=WIN32
else
UNAME_S:=$(shell uname -s)
ifeq ($(UNAME_S),Linux)
OSDETECT:=LINUX
endif
ifeq ($(UNAME_S),Darwin)
OSDETECT:=OSX
endif
endif
CPUDETECT:=
ifeq ($(OS),Windows_NT)
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
CPUDETECT:=AMD64
endif
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
CPUDETECT:=IA32
endif
else
UNAME_P := $(shell uname -p)
ifeq ($(UNAME_P),x86_64)
CPUDETECT:=AMD64
endif
ifneq ($(filter %86,$(UNAME_P)),)
CPUDETECT:=IA32
endif
ifneq ($(filter arm%,$(UNAME_P)),)
CPUDETECT:=ARM
endif
endif
PATHDELIM:=/
ifeq ($(OSDETECT),WIN32)
PATHDELIM:=\\
endif
PATHDELIM:=$(strip $(PATHDELIM))
PCP:=
ifeq ($(OSDETECT),WIN32)
PCP:=$(LOCALAPPDATA)\lazarus
else
ifeq ($(OSDETECT),LINUX)
PCP:='~/.lazarus'
else
ifeq ($(OSDETECT),OSX)
PCP:=~/.lazarus
else
PCP:=~/.lazarus
endif
endif
endif
LP:=
ifeq ($(OSDETECT),WIN32)
LP:=C:\lazarus
else
ifeq ($(OSDETECT),LINUX)
LP:=~/lazarus
else
ifeq ($(OSDETECT),OSX)
LP:=~/lazarus
else
LP:=~/lazarus
endif
endif
endif
LAZBUILD:=$(LP)$(PATHDELIM)lazbuild
ZP:=$(shell $(LAZBUILD) --pcp=$(PCP) cad_source$(PATHDELIM)zcad.lpi --get-expand-text=$$\(ProjPath\)..$(PATHDELIM)cad$(PATHDELIM)bin$(PATHDELIM)$$\(TargetCPU\)-$$\(TargetOS\))
checkallvars: checkvars
@echo OSDETECT=$(OSDETECT)
@echo CPUDETECT=$(CPUDETECT)
checkvars:
@echo PCP=$(PCP)
@echo LP=$(LP)
@echo ZP=$(ZP)
clean:
rm -rf cad_source/autogenerated/*
rm -rf cad_source/autogenerated
rm -rf cad/*
rm -rf cad
rm -rf lib/*
rm -rf errors/*.bak
rm -rf errors/*.dbpas
updatezcadenv: checkvars
rm -rf cad/blocks
rm -rf cad/components
rm -rf cad/configs
rm -rf cad/examples
rm -rf cad/fonts
rm -rf cad/images
rm -rf cad/languages
rm -rf cad/log
rm -rf cad/menu
rm -rf cad/plugins
rm -rf cad/programdb
rm -rf cad/template
cp -r environment/runtimefiles/common/* cad
cp -r environment/runtimefiles/zcad/* cad
updatezcadelectrotechenv: checkvars
rm -rf cad/blocks
rm -rf cad/components
rm -rf cad/configs
rm -rf cad/examples
rm -rf cad/fonts
rm -rf cad/images
rm -rf cad/languages
rm -rf cad/log
rm -rf cad/menu
rm -rf cad/plugins
rm -rf cad/programdb
rm -rf cad/template
cp -r environment/runtimefiles/common/* cad
cp -r environment/runtimefiles/zcadelectrotech/* cad
zcadenv: checkvars
mkdir cad
mkdir $(subst /,$(PATHDELIM),cad_source/autogenerated)
cp -r environment/runtimefiles/common/* cad
cp -r environment/runtimefiles/zcad/* cad
echo create_file>cad_source/autogenerated/buildmode.inc
rm -r cad_source/autogenerated/buildmode.inc
zcadelectrotechenv: checkvars
mkdir cad
mkdir $(subst /,$(PATHDELIM),cad_source/autogenerated)
cp -r environment/runtimefiles/common/* cad
cp -r environment/runtimefiles/zcadelectrotech/* cad
echo create_file>cad_source/autogenerated/buildmode.inc
rm -r cad_source/autogenerated/buildmode.inc
version:
echo ZCAD Version: $(ZCVERSION)
echo quoted ZCAD Version: $(QZCVERSION)
# @echo $(QZCVERSION) > cad_source/zcadversion.inc
ifeq ($(OSDETECT),WIN32)
cmd.exe "/C echo '$(ZCVERSION)' > cad_source/zcadversion.inc"
else
echo \'$(ZCVERSION)\' > cad_source/zcadversion.inc
endif
@echo $(ZCVERSION) > cad_source/zcadversion.txt
zcad: checkvars version
$(LAZBUILD) --pcp=$(PCP) cad_source/utils/typeexporter.lpi
environment/typeexporter/typeexporter pathprefix=cad_source/ outputfile=cad/rtl/system.pas processfiles=environment/typeexporter/zcad.files
$(LAZBUILD) --pcp=$(PCP) cad_source/zcad.lpi
zcadelectrotech: checkvars version
$(LAZBUILD) --pcp=$(PCP) cad_source/utils/typeexporter.lpi
environment/typeexporter/typeexporter pathprefix=cad_source/ outputfile=cad/rtl/system.pas processfiles=environment/typeexporter/zcad.files+environment/typeexporter/zcadelectrotech.files define=ELECTROTECH
$(LAZBUILD) --pcp=$(PCP) cad_source/zcad.lpi
afterzcadelectrotechbuild: checkallvars version
$(ZP)/zcad nosplash runscript cad/components/afterbuild.cmd
cad:
mkdir cad
cad/help:
mkdir $(subst /,$(PATHDELIM),cad/help)
cad/help/locale:
mkdir $(subst /,$(PATHDELIM),cad/help/locale)
cad/help/locale/ru:
mkdir $(subst /,$(PATHDELIM),cad/help/locale/ru)
cad/help/locale/ru/_images:
mkdir $(subst /,$(PATHDELIM),cad/help/locale/ru/_images)
documentation: checkvars cad cad/help cad/help/locale cad/help/locale/ru cad/help/locale/ru/_images
$(MAKE) -C cad_source/docs/userguide all
cp cad_source/docs/userguide/*.html cad/help
cp cad_source/docs/userguide/*.pdf cad/help
cp -r cad_source/docs/userguide/locale/ru/_images/* cad/help/locale/ru/_images
tests: checkvars
$(MAKE) -C cad_source/components/zcontainers/tests LP=$(LP) PCP=$(PCP) clean all
$(MAKE) -C cad_source/zengine/tests LP=$(LP) PCP=$(PCP) clean all
updatelocalizedpofiles: checkvars
cp cad/languages/rtzcad.po cad/languages/rtzcad.pot
$(LP)$(PATHDELIM)tools$(PATHDELIM)updatepofiles cad/languages/rtzcad.pot
rm -rf cad/languages/rtzcad.pot
cp $(LP)$(PATHDELIM)lcl/languages/*.po cad/languages
cp $(LP)$(PATHDELIM)components/anchordocking/languages/*.po cad/languages
cleanzcad: clean zcadenv zcad
cleanzcadelectrotech: clean zcadelectrotechenv zcadelectrotech
rmpkgslibs:
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)metadarkstyle$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)zcontainers$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)zbaseutils$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)zbaseutilsgui$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)zebase$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)zcontrols$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)zmacros$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)zmath$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)zobjectinspector$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)zscriptbase$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)zscript$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)ztoolbars$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)zundostack$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)fpdwg$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)fpspreadsheet$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)fpspreadsheet$(PATHDELIM)source$(PATHDELIM)common$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)fpspreadsheet$(PATHDELIM)source$(PATHDELIM)visual$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)lape$(PATHDELIM)package$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)zreaders$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)components$(PATHDELIM)fphunspell$(PATHDELIM)lib$(PATHDELIM)*
rm -rf cad_source$(PATHDELIM)simplecad$(PATHDELIM)lib$(PATHDELIM)*
rm -rf lib$(PATHDELIM)*
installpkgstolaz: checkvars rmpkgslibs
ifneq ($(OSDETECT),OSX)
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)other$(PATHDELIM)agraphlaz$(PATHDELIM)lazarus$(PATHDELIM)ag_graph.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)other$(PATHDELIM)agraphlaz$(PATHDELIM)lazarus$(PATHDELIM)ag_math.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)other$(PATHDELIM)agraphlaz$(PATHDELIM)lazarus$(PATHDELIM)ag_vectors.lpk
endif
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)other$(PATHDELIM)uniqueinstance$(PATHDELIM)uniqueinstance_package.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)components$(PATHDELIM)metadarkstyle$(PATHDELIM)metadarkstyle.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)components$(PATHDELIM)zcontainers$(PATHDELIM)zcontainers.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)components$(PATHDELIM)zbaseutils$(PATHDELIM)zbaseutils.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)components$(PATHDELIM)zbaseutilsgui$(PATHDELIM)zbaseutilsgui.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)components$(PATHDELIM)zebase$(PATHDELIM)zebase.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)components$(PATHDELIM)zcontrols$(PATHDELIM)zcontrols.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)components$(PATHDELIM)zmacros$(PATHDELIM)zmacros.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)components$(PATHDELIM)zmath$(PATHDELIM)zmath.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)components$(PATHDELIM)zobjectinspector$(PATHDELIM)zobjectinspector.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)components$(PATHDELIM)zscriptbase$(PATHDELIM)zscriptbase.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)components$(PATHDELIM)zscript$(PATHDELIM)zscript.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)components$(PATHDELIM)ztoolbars$(PATHDELIM)ztoolbars.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)components$(PATHDELIM)zundostack$(PATHDELIM)zundostack.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)components$(PATHDELIM)fpdwg$(PATHDELIM)fpdwg.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)components$(PATHDELIM)fpspreadsheet$(PATHDELIM)laz_fpspreadsheet_visual_dsgn.lpk
$(LAZBUILD) --pcp=$(PCP) cad_source$(PATHDELIM)components$(PATHDELIM)lape$(PATHDELIM)package$(PATHDELIM)lape.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)components$(PATHDELIM)zreaders$(PATHDELIM)zreaders.lpk
$(LAZBUILD) --pcp=$(PCP) --add-package cad_source$(PATHDELIM)components$(PATHDELIM)fphunspell$(PATHDELIM)fphunspell.lpk
# $(LAZBUILD) --pcp=$(PCP) --build-ide=""