-
Notifications
You must be signed in to change notification settings - Fork 80
/
Makefile.fpc
283 lines (236 loc) · 7.48 KB
/
Makefile.fpc
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
#
# Makefile.fpc for Lazarus for Free Pascal
#
[package]
name=lazarus
version=$(IDEVERSION)
[require]
packages=regexpr
[target]
programs=lazarus startlazarus
dirs=lcl packager/registration ideintf packager components
exampledirs=examples
[compiler]
[clean]
files=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT)) $(wildcard *.lfm)
[install]
fpcpackage=n
basedir=share/lazarus
[dist]
destdir=$(BASEDIR)/dist
[prerules]
RCPP?=$(strip $(firstword cpp$(SRCEXEEXT)))
#
LAZARUS_INSTALL_DIR=$(INSTALL_PREFIX)/share/lazarus
INSTALL_MAN_DIR=$(INSTALL_PREFIX)/share/man
ifneq ($(findstring $(OS_TARGET),win32 win64),)
LAZARUS_INSTALL_DIR=C:\lazarus
endif
ifneq ($(findstring $(OS_TARGET),freebsd),)
LAZARUS_INSTALL_DIR=/usr/local/lazarus
endif
ifneq ($(findstring $(OS_TARGET),win32 win64),)
IDEVERSION=$(shell .\tools\install\get_lazarus_version.bat)
else
IDEVERSION=$(shell ./tools/install/get_lazarus_version.sh)
endif
#-----------------------------------------------------------------------------
[rules]
.PHONY: lcl components packager/registration ideintf packager bigidecomponents ide idepkg idebig bigide starter lazbuilder tools all clean cleanide purge examples install lazbuild
#-----------------------------------------------------------------------------
ide:
$(MAKE) -C ide ide
#-----------------------------------------------------------------------------
idepkg:
$(MAKE) -C ide idepkg
#-----------------------------------------------------------------------------
bigide: lcl packager/registration ideintf packager bigidecomponents idebig starter lazbuilder
#-----------------------------------------------------------------------------
idebig:
$(MAKE) -C ide bigide
#-----------------------------------------------------------------------------
bigidecomponents:
$(MAKE) -C components bigidecomponents
#-----------------------------------------------------------------------------
bigideclean: cleanlaz
$(MAKE) -C components bigideclean
#-----------------------------------------------------------------------------
starter:
$(MAKE) -C ide starter
#-----------------------------------------------------------------------------
lazbuild: lazbuilder
lazbuilder:
$(MAKE) -C lcl/interfaces/nogui
$(MAKE) -C ide lazbuilder LCL_PLATFORM=nogui
#-----------------------------------------------------------------------------
tools: lcl
$(MAKE) -C tools
#-----------------------------------------------------------------------------
examples: lcl components
#-----------------------------------------------------------------------------
all: lcl packager/registration ideintf packager components ide starter lazbuilder
#-----------------------------------------------------------------------------
cleanide:
$(MAKE) -C ide cleanide
cleanlaz: cleanide
$(MAKE) -C lcl clean
$(MAKE) -C components clean
$(MAKE) -C packager clean
$(MAKE) -C ideintf clean
purge: cleanlaz
$(MAKE) -C examples clean
$(MAKE) -C tools clean
# $(MAKE) -C doceditor clean
$(MAKE) -C tools clean
clean: cleanlaz
cleanall: purge
# create dirs
installbase:
ifneq ($(findstring $(OS_TARGET),win32 win64),)
else
$(MKDIR) $(INSTALL_PREFIX)/share
$(MKDIR) $(INSTALL_PREFIX)/share/lazarus
$(MKDIR) $(INSTALL_BINDIR)
$(MKDIR) $(INSTALL_MAN_DIR)
$(MKDIR) $(INSTALL_MAN_DIR)/man1
endif
#-----------------------------------------------------------------------------
# Many C expect 'make install' to copy the binaries to somewhere
# Copy the lazarus tree to the install directory and set a link
install:
$(MAKE) installbase
$(COPYTREE) . $(LAZARUS_INSTALL_DIR)
ifneq ($(findstring $(OS_TARGET),win32 win64),)
else
ln -sf $(LAZARUS_INSTALL_DIR)/lazarus $(INSTALL_PREFIX)/bin/lazarus-ide
ln -sf $(LAZARUS_INSTALL_DIR)/startlazarus $(INSTALL_PREFIX)/bin/startlazarus
ln -sf $(LAZARUS_INSTALL_DIR)/lazbuild $(INSTALL_PREFIX)/bin/lazbuild
cat install/man/man1/lazarus-ide.1 | gzip > $(INSTALL_MAN_DIR)/man1/lazarus-ide.1.gz
cat install/man/man1/startlazarus.1 | gzip > $(INSTALL_MAN_DIR)/man1/startlazarus.1.gz
cat install/man/man1/lazbuild.1 | gzip > $(INSTALL_MAN_DIR)/man1/lazbuild.1.gz
endif
# Build dir
ifndef BUILDDIR
BUILDDIR=$(BASEDIR)/build
endif
##########################################################################
# Debian
##########################################################################
ifeq ($(OS_TARGET),linux)
ifndef DEBDIR
DEBDIR=debian
endif
# Link Tree
ifdef LINKISCOPY
ifndef LINKTREE
LINKTREE:=$(CPPROG) -Rfp
endif
else
ifndef LINKTREE
LINKTREE:=$(CPPROG) -Rfpl
endif
endif
ifneq ($(wildcard ${DEBDIR}/changelog),)
.PHONY: debcopy deb
DEBPACKAGEVERSION:=$(shell head -n 1 ${DEBDIR}/changelog | awk '{ print $$2 }' | tr -d '[()]')
DEBVERSION=$(firstword $(subst -, ,${DEBPACKAGEVERSION}))
DEBBUILD=$(lastword $(subst -, ,${DEBPACKAGEVERSION}))
DEBSRC=lazarus-${DEBVERSION}
DEBSRCDIR=${BUILDDIR}/${DEBSRC}
DEBSRC_ORIG=lazarus_${DEBVERSION}.orig
BUILDDATE=$(shell /bin/date --utc +%Y%m%d)
ifdef MENTORS
DEB_BUILDPKG_OPT=-sa
else
DEB_BUILDPKG_OPT=
endif
ifeq ($(wildcard ${DEBSRC_ORIG}.tar.gz),)
ifeq (${DEBBUILD},0)
DEBUSESVN=1
endif
ifeq (${DEBBUILD},1)
DEBUSESVN=1
endif
ifeq (${DEBBUILD},)
DEBUSESVN=1
endif
ifdef SNAPSHOT
DEBUSESVN=1
endif
ifndef DEBUSESVN
$(error Need "${DEBSRC_ORIG}.tar.gz" to build for DEBBUILD = "${DEBBUILD}" > 1)
endif
endif
ifndef SIGN
DEB_BUILDPKG_OPT+= -us -uc
endif
debcheck:
ifneq ($(DEBVERSION),$(PACKAGE_VERSION))
@$(ECHO) "Debian version ($(DEBVERSION)) is not correct, expect $(PACKAGE_VERSION)"
@exit 1
endif
debcopy: distclean
${DELTREE} ${BUILDDIR}
${MKDIRTREE} $(DEBSRCDIR)
ifdef DEBUSESVN
$(LINKTREE) Makefile.fpc $(DEBSRCDIR)
$(LINKTREE) COPYING.* $(DEBSRCDIR)
$(LINKTREE) README.txt $(DEBSRCDIR)
$(LINKTREE) components $(DEBSRCDIR)
$(LINKTREE) converter $(DEBSRCDIR)
$(LINKTREE) debugger $(DEBSRCDIR)
$(LINKTREE) designer $(DEBSRCDIR)
$(LINKTREE) doceditor $(DEBSRCDIR)
$(LINKTREE) docs $(DEBSRCDIR)
$(LINKTREE) install $(DEBSRCDIR)
$(LINKTREE) examples $(DEBSRCDIR)
$(LINKTREE) ide $(DEBSRCDIR)
$(LINKTREE) ideintf $(DEBSRCDIR)
$(LINKTREE) images $(DEBSRCDIR)
$(LINKTREE) languages $(DEBSRCDIR)
$(LINKTREE) lazarus.app $(DEBSRCDIR)
$(LINKTREE) lcl $(DEBSRCDIR)
$(LINKTREE) packager $(DEBSRCDIR)
$(LINKTREE) test $(DEBSRCDIR)
$(LINKTREE) tools $(DEBSRCDIR)
# add ide/revision.inc
echo "const RevisionStr = '${SVNVERSION}';" > $(DEBSRCDIR)/ide/revision.inc
else
tar -C ${BUILDDIR} -zxf ${DEBSRC_ORIG}.tar.gz ${DEBSRC}
${DELTREE} $(DEBSRCDIR)/debian
endif
debsetup:
$(LINKTREE) ${DEBDIR} $(DEBSRCDIR)/debian
ifdef SNAPSHOT
sed -e "s/${DEBPACKAGEVERSION}/${DEBPACKAGEVERSION}-${BUILDDATE}/" $(DEBSRCDIR)/debian/changelog > $(DEBSRCDIR)/debian/changelog.tmp
${MOVE} $(DEBSRCDIR)/debian/changelog.tmp $(DEBSRCDIR)/debian/changelog
endif
chmod 755 $(DEBSRCDIR)/debian/rules
find $(DEBSRCDIR) -name '.svn' | xargs -n1 rm -rf
debbuild:
cd ${DEBSRCDIR} ; dpkg-buildpackage ${DEB_BUILDPKG_OPT}
debcheckpolicy:
ifdef LINTIAN
cd ${DEBSRCDIR} ; lintian -i ../*.changes
endif
debclean:
ifndef DEBUSESVN
${DEL} ${BUILDDIR}/${DEBSRC_ORIG}.tar.gz
endif
mv -v -t . \
$(DEBSRCDIR)/../*.changes \
$(DEBSRCDIR)/../*.deb \
$(DEBSRCDIR)/../*.dsc \
$(DEBSRCDIR)/../*.gz
${DELTREE} $(DEBSRCDIR)
rmdir $(BUILDDIR)
deb: debcheck debcopy deborigtargz debsetup debbuild debcheckpolicy debclean
deborigtargz:
ifdef DEBUSESVN
#$(MAKE) fpc_zipinstall USETAR=y ZIPTARGET=debcopy PACKDIR=$(DEBSRCDIR) FULLZIPNAME=${DEBSRC_ORIG}
tar -C ${BUILDDIR} -zcf ${BUILDDIR}/${DEBSRC_ORIG}.tar.gz --exclude-vcs ${DEBSRC}
else
${LINKTREE} ${DEBSRC_ORIG}.tar.gz ${BUILDDIR}/${DEBSRC_ORIG}.tar.gz
endif
endif # changelog found
endif