| 289 |
dpurdie |
1 |
###############################################################################
|
| 6177 |
dpurdie |
2 |
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
|
| 289 |
dpurdie |
3 |
#
|
|
|
4 |
# File: TOOLSET/delphi7.rul[e]
|
|
|
5 |
# Contents: Rules to build Delphi
|
|
|
6 |
#
|
|
|
7 |
###############################################################################
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
###############################################################################
|
|
|
11 |
#.. Parse user options
|
|
|
12 |
# Global options already parsed
|
|
|
13 |
# These options extend the global options
|
|
|
14 |
#
|
|
|
15 |
ifdef OPTIONS
|
|
|
16 |
|
|
|
17 |
ifneq "$(findstring wall,$(OPTIONS))" "" # Enable all warnings
|
|
|
18 |
USE_WALL = 1
|
|
|
19 |
endif
|
|
|
20 |
|
|
|
21 |
endif
|
|
|
22 |
|
|
|
23 |
#
|
|
|
24 |
################################################################################
|
|
|
25 |
#Syntax: dcc32 [options] filename [options]
|
|
|
26 |
#
|
|
|
27 |
# -A<unit>=<alias> = Set unit alias -LU<package> = Use package
|
|
|
28 |
# -B = Build all units -M = Make modified units
|
|
|
29 |
# -CC = Console target -N<path> = DCU output directory
|
|
|
30 |
# -CG = GUI target -O<paths> = Object directories
|
|
|
31 |
# -D<syms> = Define conditionals -P = look for 8.3 file names also
|
|
|
32 |
# -E<path> = EXE output directory -Q = Quiet compile
|
|
|
33 |
# -F<offset> = Find error -R<paths> = Resource directories
|
|
|
34 |
# -GD = Detailed map file -U<paths> = Unit directories
|
|
|
35 |
# -GP = Map file with publics -V = Debug information in EXE
|
|
|
36 |
# -GS = Map file with segments -VR = Generate remote debug (RSM)
|
|
|
37 |
# -H = Output hint messages -W = Output warning messages
|
|
|
38 |
# -I<paths> = Include directories -Z = Output 'never build' DCPs
|
|
|
39 |
# -J = Generate .obj file -$<dir> = Compiler directive
|
|
|
40 |
# -JP = Generate C++ .obj file --help = Show this help screen
|
|
|
41 |
# -K<addr> = Set image base addr --version = Show name and version
|
|
|
42 |
#
|
|
|
43 |
#Compiler switches: -$<letter><state> (defaults are shown below)
|
|
|
44 |
# A8 Aligned record fields P+ Open string params
|
|
|
45 |
# B- Full boolean Evaluation Q- Integer overflow checking
|
|
|
46 |
# C+ Evaluate assertions at runtime R- Range checking
|
|
|
47 |
# D+ Debug information T- Typed @ operator
|
|
|
48 |
# G+ Use imported data references U- Pentium(tm)-safe divide
|
|
|
49 |
# H+ Use long strings by default V+ Strict var-strings
|
|
|
50 |
# I+ I/O checking W- Generate stack frames
|
|
|
51 |
# J- Writeable structured consts X+ Extended syntax
|
|
|
52 |
# L+ Local debug symbols Y+ Symbol reference info
|
|
|
53 |
# M- Runtime type info Z1 Minimum size of enum types
|
|
|
54 |
# O+ Optimization
|
|
|
55 |
################################################################################
|
|
|
56 |
|
|
|
57 |
#
|
|
|
58 |
# Calculate definitions common to all the build modes
|
|
|
59 |
# Definitions
|
|
|
60 |
# Include Paths
|
|
|
61 |
# Object Directories
|
|
|
62 |
# Resource Dirs
|
|
|
63 |
# Unit Dirs
|
|
|
64 |
#
|
|
|
65 |
dcc_defines =
|
| 297 |
dpurdie |
66 |
dcc_delphi_core =
|
| 289 |
dpurdie |
67 |
dcc_flags = $(CFLAGS)
|
|
|
68 |
|
|
|
69 |
ifeq "$(DEBUG)" "1"
|
| 297 |
dpurdie |
70 |
dcc_defines += -DDEBUG -$$D+ -$$L+
|
|
|
71 |
dcc_delphi_core += $(DELPHI7)/Lib/Debug $(DELPHI7)/Lib
|
| 289 |
dpurdie |
72 |
else
|
| 297 |
dpurdie |
73 |
dcc_delphi_core += $(DELPHI7)/Lib
|
|
|
74 |
dcc_defines += -$$D
|
| 289 |
dpurdie |
75 |
endif
|
|
|
76 |
|
| 297 |
dpurdie |
77 |
dcc_includes = $(INCDIRS) $(dcc_delphi_core)
|
|
|
78 |
dcc_resources = $(OBJDIR) $(dcc_delphi_core)
|
|
|
79 |
dcc_units = $(LIBDIRS) $(dcc_delphi_core)
|
|
|
80 |
|
|
|
81 |
|
| 289 |
dpurdie |
82 |
dcc_defines += -D__SOURCE__=\"$(notdir $(PSOURCE))\"
|
|
|
83 |
|
|
|
84 |
ifdef USE_WALL
|
|
|
85 |
dcc_flags += -W -H
|
|
|
86 |
endif
|
|
|
87 |
|
| 295 |
dpurdie |
88 |
dcc_common_flags = -Q -Z -GP -GS \
|
| 289 |
dpurdie |
89 |
$(dcc_flags) \
|
|
|
90 |
$(dcc_defines) \
|
|
|
91 |
$(patsubst %,-I%,$(dcc_includes)) \
|
| 295 |
dpurdie |
92 |
$(patsubst %,-R%,$(dcc_resources) $(dcc_includes)) \
|
| 289 |
dpurdie |
93 |
$(patsubst %,-U%,$(dcc_units))
|
|
|
94 |
|
|
|
95 |
#
|
|
|
96 |
# Rule to create a program
|
|
|
97 |
# Defs:
|
|
|
98 |
# PSOURCE - Path to the source
|
|
|
99 |
# PFLAGS - Flags from the Prog directive
|
|
|
100 |
# PACKAGES - Packages to be used
|
|
|
101 |
# $@ - Path to the output
|
|
|
102 |
#
|
|
|
103 |
# Delphi has a mind of its own
|
|
|
104 |
# Must check that its doing what we want to prevent the user doing silly things
|
|
|
105 |
#
|
|
|
106 |
define DCC
|
| 6177 |
dpurdie |
107 |
@echo '[$(notdir $(PSOURCE))] compiling prog..'
|
| 289 |
dpurdie |
108 |
$(AA_PRE)-rm -f $@
|
| 295 |
dpurdie |
109 |
$(XX_PRE)$(DELPHI7)/bin/dcc32 $(dcc_common_flags) -E$(BINDIR) $(PFLAGS) -N$(OBJDIR) $(patsubst %,-LU%,$(PACKAGES)) $(subst /,\\,$(PSOURCE))
|
| 289 |
dpurdie |
110 |
$(AA_PRE)if [ ! -f $@ ] ; then echo "[Make] (E) Build artifact not found: $@"; exit 1; fi
|
|
|
111 |
endef
|
|
|
112 |
|
|
|
113 |
#
|
|
|
114 |
# Rule to create a Shared Library
|
|
|
115 |
# Defs:
|
|
|
116 |
# PSOURCE - Path to the source
|
|
|
117 |
# PFLAGS - Flags from the Prog directive
|
|
|
118 |
# SHLIBBASE - Base name of the shared library
|
|
|
119 |
# PACKAGES - Packages to be used
|
|
|
120 |
# $@ - Path to the output
|
|
|
121 |
#
|
|
|
122 |
# Delphi has a mind of its own
|
|
|
123 |
# Must check that its doing what we want to prevent the user doing silly things
|
|
|
124 |
#
|
|
|
125 |
# Put any DCUs that are created into the OBJ directory
|
|
|
126 |
# Since they are created as a side effect we can hide them away
|
|
|
127 |
#
|
|
|
128 |
define SHDCC
|
| 6177 |
dpurdie |
129 |
@echo '[$(notdir $(PSOURCE))] compiling library..'
|
| 289 |
dpurdie |
130 |
$(AA_PRE)-rm -f $@
|
|
|
131 |
$(XX_PRE)$(DELPHI7)/bin/dcc32 $(dcc_common_flags) -E$(LIBDIR) -LE$(LIBDIR) $(PFLAGS) -LN$(LIBDIR) -N$(OBJDIR)/$(SHLIBBASE) $(patsubst %,-LU%,$(PACKAGES)) $(subst /,\\,$(PSOURCE))
|
|
|
132 |
$(AA_PRE)if [ ! -f $@ ] ; then echo "[Make] (E) Build artifact not found: $@"; exit 1; fi
|
|
|
133 |
endef
|
|
|
134 |
|
|
|
135 |
#
|
|
|
136 |
# Rule to create a .LIB from a .DLL
|
| 295 |
dpurdie |
137 |
# Defs:
|
|
|
138 |
# TMPFILE - PAth of temp file
|
| 289 |
dpurdie |
139 |
#
|
|
|
140 |
define IMPLIB
|
| 6177 |
dpurdie |
141 |
@echo '[$(notdir $(notdir $@))] create import library..'
|
| 295 |
dpurdie |
142 |
$(AA_PRE)if [ ! -x "$(BCB_IMPDEF_PATH)/impdef.exe" ] ; then echo "[Make] (E) Need, from borland builder: $(BCB_IMPDEF_PATH)/impdef"; exit 1; fi
|
|
|
143 |
$(AA_PRE)if [ ! -x "$(MS_LINK_PATH)/link.exe" ] ; then echo "[Make] (E) Need, from MS VC6: $(MS_LINK_PATH)/link"; exit 1; fi
|
|
|
144 |
$(AA_PRE)-rm -f $@ $(TMPFILE)
|
|
|
145 |
$(XX_PRE)$(BCB_IMPDEF_PATH)/impdef $(TMPFILE) $<
|
|
|
146 |
$(XX_PRE)$(MS_LINK_PATH)/link /lib /machine:ix86 /def:$(TMPFILE) /out:$@
|
| 289 |
dpurdie |
147 |
$(AA_PRE)if [ ! -f $@ ] ; then echo "[Make] (E) Build artifact not found: $@"; exit 1; fi
|
|
|
148 |
endef
|
|
|
149 |
|
|
|
150 |
#
|
|
|
151 |
# Rule to create a Unit
|
|
|
152 |
# Defs:
|
|
|
153 |
# PSOURCE - Path to the source
|
|
|
154 |
# $@ - Path to the output
|
|
|
155 |
#
|
|
|
156 |
# Delphi has a mind of its own
|
|
|
157 |
# Must check that its doing what we want to prevent the user doing silly things
|
|
|
158 |
#
|
|
|
159 |
define DCC_AR
|
| 6177 |
dpurdie |
160 |
@echo '[$(notdir $(PSOURCE))] compiling unit..'
|
| 289 |
dpurdie |
161 |
$(AA_PRE)-rm -f $@
|
| 295 |
dpurdie |
162 |
$(XX_PRE)$(DELPHI7)/bin/dcc32 $(dcc_common_flags) -E$(BINDIR) $(PFLAGS) -N$(LIBDIR) $(patsubst %,-LU%,$(PACKAGES)) $(subst /,\\,$(PSOURCE))
|
| 289 |
dpurdie |
163 |
$(AA_PRE)if [ ! -f $@ ] ; then echo "[Make] (E) Build artifact not found: $@"; exit 1; fi
|
|
|
164 |
endef
|
|
|
165 |
|
| 295 |
dpurdie |
166 |
#
|
|
|
167 |
# Rule to compile a resource file
|
|
|
168 |
# $@ - Target
|
|
|
169 |
# $< - source file ( first prereq: MUST BE )
|
|
|
170 |
#
|
|
|
171 |
define DRES
|
| 6177 |
dpurdie |
172 |
@echo '[$(notdir $(@))] Compile Resource..'
|
| 295 |
dpurdie |
173 |
$(XX_PRE)$(DELPHI7)/bin/brcc32 -fo$@ -x $< $(patsubst %,-i%,$(dcc_includes))
|
|
|
174 |
endef
|
|
|
175 |
|