summaryrefslogtreecommitdiff
path: root/packages/ide/Makefile.fpc.fpcmake
blob: 8eeace37ce9e73437e951b45e54d6fc11b7bb9a1 (plain)
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
#
#   $Id: Makefile.fpc,v 1.32 2005/05/05 12:59:59 peter Exp $
#
#   Makefile.fpc for FP IDE
#

[package]
name=ide
version=3.2.0rc1

[target]
dirs=compiler
programs=fp
rst=fpstrings

[install]
datadir=$(INSTALL_BASEDIR)/ide
fpcpackage=y

[compiler]
options=-Sg

[require]
packages=fv gdbint regexpr chm  fcl-base fcl-xml
packages_go32v2=graph
libc=y

[default]
fpcdir=..

[prerules]
#
# Automatic detection if libgdb.a is present
#

# set default value for PPC_TARGET
ifndef PPC_TARGET
PPC_TARGET=$(CPU_TARGET)
endif

# do not add -d$(CPU_TARGET)
override NOCPUDEF=1
# Use PPC_TARGET instead
override FPCOPT+= -d$(PPC_TARGET)

ifndef NOGDB

ifeq ($(FULL_TARGET),i386-win32)
needlinkparam=1
endif


ifeq ($(FULL_TARGET),x86_64-win64)
needlinkparam=1
endif

ifeq ($(OS_TARGET),freebsd)
needusrlocallib=1
neednostdlib=1
endif
ifeq ($(OS_TARGET),openbsd)
needusrlocallib=1
needusrlib=1
neednostdlib=1
endif
ifeq ($(OS_TARGET),netbsd)
neednostdlib=1
endif
ifeq ($(OS_TARGET),aix)
neednostdlib=1
endif

ifdef needlinkparam
override SPECIALLINK=-Xe -k--allow-multiple-definition
endif

ifdef needusrlib
override SPECIALLINK+=-Fl/usr/lib
endif
ifdef needusrlocallib
override SPECIALLINK+=-Fl/usr/local/lib
endif
ifdef neednostdlib
override SPECIALLINK+=-Xd
endif

ifeq ($(OS_TARGET),aix)
override SPECIALLINK+=6fl/opt/freeware/lib -k-bbigtoc
endif

# Try to find GDB library
# Look for a valid GDBLIBDIR environment variable
ifdef GDBLIBDIR
override LIBGDBFILE:=$(firstword $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR))))
endif

# Use default dirs if not available
ifeq ($(LIBGDBFILE),)
# Default locations <target>/<cpu> (linux) or <target> (win32,go32v2) only
override GDBLIBDIR=$(wildcard $(FPCDIR)/libgdb/$(OS_TARGET)/$(CPU_TARGET))
ifeq ($(GDBLIBDIR),)
override GDBLIBDIR=$(FPCDIR)/libgdb/$(OS_TARGET)
endif
# Detect if libgdb.a is available
override LIBGDBFILE:=$(firstword $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR))))
endif

# No custom libgdb.a found, try using system default library if available
ifeq ($(LIBGDBFILE),)
SYSLIBDIR=/lib /usr/lib /usr/local/lib
# Detect if libgdb.a is available
override LIBGDBFILE=$(firstword $(wildcard $(addsuffix /libgdb.a,$(SYSLIBDIR))))
ifneq (${LIBGDBFILE},)
$(warning Using system default libgdb file located in ${LIBGDBFILE})
GDBLIBDIR=$(dir ${LIBGDBFILE})
endif
endif

# Disable GDB when no libgdb.a found
ifeq ($(LIBGDBFILE),)
GDB=
else
GDB=1
# Detect if gdblib.inc is available
override LIBGDBINC:=$(firstword $(wildcard $(addsuffix /gdblib.inc,$(GDBLIBDIR))))
ifeq ($(LIBGDBINC),)
GDBLIBINCFOUND=0
GDBLIBINCCOND=
else
GDBLIBINCFOUND=1
GDBLIBINCCOND=-dUSE_GDBLIBINC -I$(GDBLIBDIR)
endif
endif

ifdef GDB
# The gdbint is already included due the gdbint package dependency
override LIBDIR+=$(GDBLIBDIR)
endif

else

# Disable
GDB=

endif  #NOGDB


[rules]
.NOTPARALLEL:

.PHONY: compilerunits compilerclean \
        nogdb gdb all \
        clean_compiler clean testgdb postgdbinfo

clean: fpc_cleanall

distclean: clean compilerclean

#
# GDB detection
#
ifndef NOGDB

ifdef GDB
testgdb:
        @$(ECHO) LibGDB found in $(LIBGDBFILE)

postgdbinfo:
        @$(ECHO) LibGDB was found, IDE has Debugger support

else
override COMPILER+=-dNODEBUG
testgdb:
        @$(ECHO) LibGDB not found
        @$(ECHO) LIBGDBFILE=$(LIBGDBFILE)
        @$(ECHO) GDBLIBDIR=$(GDBLIBDIR)
        @$(ECHO) $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR)))

postgdbinfo:
        @$(ECHO) LibGDB was not found, IDE has no Debugger support
endif

else
testgdb:
        @$(ECHO) Building without Debugger
postgdbinfo:
        @$(ECHO) Debugger disabled, IDE has no Debugger support
override COMPILER+=-dNODEBUG
endif  # NOGDB


#
# Compiler
#

compilerunits : compiler/$(FPCMADE)
compiler/$(FPCMADE):
        $(MAKE) -C compiler all

compilerclean :
        $(MAKE) -C compiler clean

#
# Build targets
#
# building happends in 2 steps, first the packages, compiler
# dirs are build. In the second step the IDE is build. This is
# required because it needs to detect which compiler version
# to use.
#
fp$(EXEEXT): $(wildcard *.pas) $(wildcard *.inc)
        $(COMPILER) $(GDBLIBINCCOND) $(SPECIALLINK) fp.pas

buildfp:
        $(MAKE) compilerunits
        $(MAKE) testgdb
        $(MAKE) fpc_all
        $(MAKE) postgdbinfo

gdb:
#        $(MAKE) -C ../packages/base/gdbint
        $(MAKE) buildfp

nogdb:
        $(MAKE) buildfp NOGDB=1

#
# Default targets
#

# By default we try to create the ide with full debugging support,
all: gdb

# This is necessary because we don't have all units separate in the
# units targets
clean: cleanall

#
# Installation
#

ifndef UNIXHier
override INSTALL_DATADIR=$(INSTALL_BINDIR)
endif

install: fpc_install
        $(MKDIR) $(INSTALL_DATADIR)
        $(MKDIR) $(INSTALL_DOCDIR)
        $(INSTALL) fp.ans $(wildcard *.pt) $(wildcard *.tdf) $(INSTALL_DATADIR)
ifeq ($(OS_TARGET),win32)
        $(INSTALL) fp32.ico $(INSTALL_DATADIR)
endif
        $(INSTALL) readme.ide $(INSTALL_DOCDIR)


#
# Misc
#
clean_compiler:
        $(MAKE) -C compiler clean
        $(MAKE) -C ../compiler ppuclean