Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
289 dpurdie 1
###############################################################################
2
# Copyright (c) 1996-2009 ERG Transit Systems.
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
#
295 dpurdie 65
dcc_delphi_core = $(DELPHI7)/Lib
289 dpurdie 66
dcc_defines =
295 dpurdie 67
dcc_includes = $(INCDIRS) $(dcc_delphi_core)
289 dpurdie 68
dcc_flags = $(CFLAGS)
295 dpurdie 69
dcc_resources = $(OBJDIR) $(dcc_delphi_core)
70
dcc_units = $(LIBDIRS) $(dcc_delphi_core)
289 dpurdie 71
 
72
ifeq "$(DEBUG)" "1"
73
dcc_defines	+= -DDEBUG -D+
74
else
75
dcc_defines	+= -D-
76
endif
77
 
78
dcc_defines	+= -D__SOURCE__=\"$(notdir $(PSOURCE))\"
79
 
80
ifdef USE_WALL
81
dcc_flags += -W -H
82
endif
83
 
295 dpurdie 84
dcc_common_flags = -Q -Z -GP -GS \
289 dpurdie 85
	$(dcc_flags) \
86
	$(dcc_defines) \
87
	$(patsubst %,-I%,$(dcc_includes)) \
295 dpurdie 88
	$(patsubst %,-R%,$(dcc_resources) $(dcc_includes)) \
289 dpurdie 89
	$(patsubst %,-U%,$(dcc_units))
90
 
91
#
92
# Rule to create a program
93
# Defs:
94
#	PSOURCE		- Path to the source
95
#	PFLAGS		- Flags from the Prog directive
96
#	PACKAGES	- Packages to be used
97
#	$@		- Path to the output
98
#
99
# Delphi has a mind of its own
100
# Must check that its doing what we want to prevent the user doing silly things
101
#
102
define DCC
103
	@echo [$(notdir $(PSOURCE))] compiling prog..
104
        $(AA_PRE)-rm -f $@
295 dpurdie 105
        $(XX_PRE)$(DELPHI7)/bin/dcc32 $(dcc_common_flags) -E$(BINDIR) $(PFLAGS) -N$(OBJDIR) $(patsubst %,-LU%,$(PACKAGES)) $(subst /,\\,$(PSOURCE))
289 dpurdie 106
        $(AA_PRE)if [ ! -f $@ ] ; then echo "[Make] (E) Build artifact not found: $@"; exit 1; fi
107
endef
108
 
109
#
110
# Rule to create a Shared Library
111
# Defs:
112
#	PSOURCE		- Path to the source
113
#	PFLAGS		- Flags from the Prog directive
114
#	SHLIBBASE	- Base name of the shared library
115
#	PACKAGES	- Packages to be used
116
#	$@		- Path to the output
117
#
118
# Delphi has a mind of its own
119
# Must check that its doing what we want to prevent the user doing silly things
120
#
121
# Put any DCUs that are created into the OBJ directory
122
# Since they are created as a side effect we can hide them away
123
#
124
define SHDCC
125
	@echo [$(notdir $(PSOURCE))] compiling library..
126
        $(AA_PRE)-rm -f $@
127
        $(XX_PRE)$(DELPHI7)/bin/dcc32 $(dcc_common_flags) -E$(LIBDIR) -LE$(LIBDIR)  $(PFLAGS) -LN$(LIBDIR) -N$(OBJDIR)/$(SHLIBBASE) $(patsubst %,-LU%,$(PACKAGES)) $(subst /,\\,$(PSOURCE))
128
        $(AA_PRE)if [ ! -f $@ ] ; then echo "[Make] (E) Build artifact not found: $@"; exit 1; fi
129
endef
130
 
131
#
132
# Rule to create a .LIB from a .DLL
295 dpurdie 133
# Defs:
134
#	TMPFILE		- PAth of temp file
289 dpurdie 135
#
136
define IMPLIB
137
	@echo [$(notdir $(notdir $@))] create import library..
295 dpurdie 138
        $(AA_PRE)if [ ! -x "$(BCB_IMPDEF_PATH)/impdef.exe" ] ; then echo "[Make] (E) Need, from borland builder: $(BCB_IMPDEF_PATH)/impdef"; exit 1; fi
139
        $(AA_PRE)if [ ! -x "$(MS_LINK_PATH)/link.exe" ] ; then echo "[Make] (E) Need, from MS VC6: $(MS_LINK_PATH)/link"; exit 1; fi
140
        $(AA_PRE)-rm -f $@ $(TMPFILE)
141
        $(XX_PRE)$(BCB_IMPDEF_PATH)/impdef $(TMPFILE) $<
142
        $(XX_PRE)$(MS_LINK_PATH)/link /lib /machine:ix86 /def:$(TMPFILE) /out:$@
289 dpurdie 143
        $(AA_PRE)if [ ! -f $@ ] ; then echo "[Make] (E) Build artifact not found: $@"; exit 1; fi
144
endef
145
 
146
#
147
# Rule to create a Unit
148
# Defs:
149
#	PSOURCE		- Path to the source
150
#	$@		- Path to the output
151
#
152
# Delphi has a mind of its own
153
# Must check that its doing what we want to prevent the user doing silly things
154
#
155
define DCC_AR
156
	@echo [$(notdir $(PSOURCE))] compiling unit..
157
        $(AA_PRE)-rm -f $@
295 dpurdie 158
        $(XX_PRE)$(DELPHI7)/bin/dcc32 $(dcc_common_flags) -E$(BINDIR) $(PFLAGS) -N$(LIBDIR) $(patsubst %,-LU%,$(PACKAGES)) $(subst /,\\,$(PSOURCE))
289 dpurdie 159
        $(AA_PRE)if [ ! -f $@ ] ; then echo "[Make] (E) Build artifact not found: $@"; exit 1; fi
160
endef
161
 
295 dpurdie 162
#
163
# Rule to compile a resource file
164
#	$@ - Target
165
#	$< - source file ( first prereq: MUST BE )
166
#
167
define DRES
168
	@echo [$(notdir $(@))] Compile Resource..
169
        $(XX_PRE)$(DELPHI7)/bin/brcc32 -fo$@ -x $< $(patsubst %,-i%,$(dcc_includes))
170
endef
171