Subversion Repositories DevTools

Rev

Rev 295 | 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
#
65
dcc_defines =
66
dcc_includes = $(INCDIRS)
67
dcc_flags = $(CFLAGS)
68
dcc_resources =
69
dcc_units = $(LIBDIRS)
70
 
71
ifeq "$(DEBUG)" "1"
72
dcc_defines	+= -DDEBUG -D+
73
else
74
dcc_defines	+= -D-
75
endif
76
 
77
dcc_defines	+= -D__SOURCE__=\"$(notdir $(PSOURCE))\"
78
 
79
ifdef USE_WALL
80
dcc_flags += -W -H
81
endif
82
 
83
dcc_common_flags = -Q -Z -GP -GS\
84
	$(dcc_flags) \
85
	$(dcc_defines) \
86
	$(patsubst %,-I%,$(dcc_includes)) \
87
	$(patsubst %,-R%,$(dcc_includes)) \
88
	$(patsubst %,-U%,$(dcc_units))
89
 
90
#
91
# Rule to create a program
92
# Defs:
93
#	PSOURCE		- Path to the source
94
#	PFLAGS		- Flags from the Prog directive
95
#	PACKAGES	- Packages to be used
96
#	$@		- Path to the output
97
#
98
# Delphi has a mind of its own
99
# Must check that its doing what we want to prevent the user doing silly things
100
#
101
define DCC
102
	@echo [$(notdir $(PSOURCE))] compiling prog..
103
        $(AA_PRE)-rm -f $@
104
        $(XX_PRE)$(DELPHI7)/bin/dcc32 $(dcc_common_flags) -E$(BINDIR) $(PFLAGS) -N$(OBJDIR) $(patsubst %,-LU%,$(PACKAGES))  $(subst /,\\,$(PSOURCE))
105
        $(AA_PRE)if [ ! -f $@ ] ; then echo "[Make] (E) Build artifact not found: $@"; exit 1; fi
106
endef
107
 
108
#
109
# Rule to create a Shared Library
110
# Defs:
111
#	PSOURCE		- Path to the source
112
#	PFLAGS		- Flags from the Prog directive
113
#	SHLIBBASE	- Base name of the shared library
114
#	PACKAGES	- Packages to be used
115
#	$@		- Path to the output
116
#
117
# Delphi has a mind of its own
118
# Must check that its doing what we want to prevent the user doing silly things
119
#
120
# Put any DCUs that are created into the OBJ directory
121
# Since they are created as a side effect we can hide them away
122
#
123
define SHDCC
124
	@echo [$(notdir $(PSOURCE))] compiling library..
125
        $(AA_PRE)-rm -f $@
126
        $(XX_PRE)$(DELPHI7)/bin/dcc32 $(dcc_common_flags) -E$(LIBDIR) -LE$(LIBDIR)  $(PFLAGS) -LN$(LIBDIR) -N$(OBJDIR)/$(SHLIBBASE) $(patsubst %,-LU%,$(PACKAGES)) $(subst /,\\,$(PSOURCE))
127
        $(AA_PRE)if [ ! -f $@ ] ; then echo "[Make] (E) Build artifact not found: $@"; exit 1; fi
128
endef
129
 
130
#
131
# Rule to create a .LIB from a .DLL
132
#
133
define IMPLIB
134
	@echo [$(notdir $(notdir $@))] create import library..
135
        $(AA_PRE)-rm -f $@
136
        $(XX_PRE)implib32.exe $<
137
        $(AA_PRE)if [ ! -f $@ ] ; then echo "[Make] (E) Build artifact not found: $@"; exit 1; fi
138
endef
139
 
140
#
141
# Rule to create a Unit
142
# Defs:
143
#	PSOURCE		- Path to the source
144
#	$@		- Path to the output
145
#
146
# Delphi has a mind of its own
147
# Must check that its doing what we want to prevent the user doing silly things
148
#
149
define DCC_AR
150
	@echo [$(notdir $(PSOURCE))] compiling unit..
151
        $(AA_PRE)-rm -f $@
152
        $(XX_PRE)$(DELPHI7)/bin/dcc32 $(dcc_common_flags) -E$(BINDIR) $(PFLAGS) -N$(LIBDIR) $(subst /,\\,$(PSOURCE))
153
        $(AA_PRE)if [ ! -f $@ ] ; then echo "[Make] (E) Build artifact not found: $@"; exit 1; fi
154
endef
155