xref: /trunk/main/sal/util/makefile.mk (revision 7871dc3e)
1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23
24PRJ=..
25
26PRJNAME=sal
27TARGET=sal
28
29NO_BSYMBOLIC=TRUE
30NO_DEFAULT_STL=TRUE
31
32USE_LDUMP2=TRUE
33USE_DEFFILE=TRUE
34
35.IF "$(GUI)"=="UNX"
36TARGETTYPE=CUI
37.ENDIF # UNX
38
39UNIXVERSIONNAMES=UDK
40
41# --- Settings -----------------------------------------------------
42
43.INCLUDE :  settings.mk
44
45CFLAGS+= $(LFS_CFLAGS)
46CXXFLAGS+= $(LFS_CFLAGS)
47
48.IF "$(depend)" == ""
49
50# --- Files --------------------------------------------------------
51
52# disable check for PIC code as it would complain about
53# hand coded assembler
54CHECKFORPIC=
55
56.IF "$(header)" == ""
57
58LIB1TARGET=$(SLB)$/$(TARGET).lib
59LIB1FILES=	\
60	$(SLB)$/oslall.lib	\
61	$(SLB)$/cpposl.lib	\
62	$(SLB)$/cpprtl.lib	\
63	$(SLB)$/textenc.lib
64
65#.IF "$(GUI)"=="UNX"
66#LIB1FILES+=$(SLB)$/systoolsunx.lib
67#.ENDIF # UNX
68
69
70LIB3TARGET=$(LB)$/a$(TARGET).lib
71LIB3ARCHIV=$(LB)$/lib$(TARGET)$(DLLPOSTFIX).a
72LIB3FILES=	\
73	$(LB)$/oslall.lib	\
74	$(LB)$/cpposl.lib	\
75	$(LB)$/cpprtl.lib	\
76	$(LB)$/textenc.lib
77
78#.IF "$(GUI)"=="UNX"
79#LIB3FILES+=$(LB)$/systoolsunx.lib
80#.ENDIF # UNX
81
82.IF "$(GUI)" == "WNT" || "$(GUI)"=="OS2"
83SHL1TARGET= $(TARGET)
84.ELSE
85SHL1TARGET= uno_$(TARGET)
86.ENDIF
87SHL1IMPLIB= i$(TARGET)
88SHL1VERSIONMAP=	$(TARGET).map
89SHL1RPATH=URELIB
90
91.IF "$(GUI)"=="WNT"
92
93.IF "$(COM)"=="GCC"
94UWINAPILIB=     -luwinapi
95.ELSE
96UWINAPILIB=     $(LB)$/uwinapi.lib
97.ENDIF
98
99SHL1STDLIBS=	\
100				$(UWINAPILIB)\
101				$(ADVAPI32LIB)\
102				$(WSOCK32LIB)\
103				$(MPRLIB)\
104				$(SHELL32LIB)\
105				$(COMDLG32LIB)\
106				$(USER32LIB)\
107				$(OLE32LIB)
108.IF "$(COM)"=="GCC"
109MINGWSSTDOBJ=
110MINGWSSTDENDOBJ=
111.ENDIF
112.ENDIF # WNT
113
114.IF "$(GUI)"=="UNX"
115.IF "$(OS)"=="SOLARIS"
116# libposix4.so (SunOS 5.6) <-> librt.so (SunOS >= 5.7)
117SHL1STDLIBS= -Bdynamic -ldl -lpthread -lposix4 -lsocket -lnsl
118.IF "$(COM)" == "C50"
119SHL1STDLIBS+= -z allextract -staticlib=Crun -z defaultextract
120.ENDIF # C50
121.ENDIF # SOLARIS
122.ENDIF # UNX
123
124.IF "$(GUI)"=="OS2"
125SHL1STDLIBS=mmap pthread
126.ENDIF # OS2
127
128# If we compile sal with STLport checking iterators
129# we need to link against the STLport
130.IF "$(USE_STLP_DEBUG)" != ""
131SHL1STDLIBS+=$(LIBSTLPORT)
132.ENDIF
133
134#The irony that using the system STL instead of
135#stlport requires that we link libsal with the
136#LIBSTLPORT alias which is not required when using
137#stlport is not lost on me
138.IF "$(USE_SYSTEM_STL)"=="YES"
139SHL1STDLIBS+=$(LIBSTLPORT)
140.ENDIF
141
142.IF "$(OS)"=="MACOSX"
143SHL1STDLIBS+=-framework CoreFoundation -framework Carbon
144.ENDIF
145
146.IF "$(OS)" == "LINUX"
147.IF "$(PAM_LINK)" == "YES"
148SHL1STDLIBS+=-lpam
149.ENDIF
150.IF "$(CRYPT_LINK)" == "YES"
151SHL1STDLIBS+=-lcrypt
152.ENDIF
153.ENDIF
154
155# #i105898# required for LD_PRELOAD libsalalloc_malloc.so
156#           if sal is linked with -Bsymbolic-functions
157.IF "$(HAVE_LD_BSYMBOLIC_FUNCTIONS)" == "TRUE"
158SHL1LINKFLAGS+=-Wl,--dynamic-list=salalloc.list
159.ENDIF # .IF "$(HAVE_LD_BSYMBOLIC_FUNCTIONS)" == "TRUE"
160
161SHL1LIBS+=$(SLB)$/$(TARGET).lib
162
163.IF "$(linkinc)" != ""
164SHL11FILE=$(MISC)$/sal.slo
165.ELSE
166.IF "$(GUI)"=="UNX"
167SHL1OBJS=
168.ELSE
169.IF "$(GUI)$(COM)"!="WNTGCC"
170SHL1OBJS= \
171    $(SLO)$/dllentry.obj
172.ENDIF # WNTGCC
173.ENDIF # UNX
174.ENDIF # lincinc
175
176SHL1DEPN=
177SHL1DEF=    $(MISC)$/$(SHL1TARGET).def
178
179DEF1NAME= $(SHL1TARGET)
180
181#
182# This part builds a tiny extra lib,
183# containing an alloc.c which uses system
184# heap instead of our own mem management.
185# This is e.g. useful for proper valgrinding
186# the office.
187#
188.IF "$(OS)"=="LINUX"
189
190TARGET2 = salalloc_malloc
191SHL2TARGET= $(TARGET2)
192SHL2IMPLIB= i$(TARGET2)
193SHL2VERSIONMAP=	salalloc.map
194
195SHL2LIBS+=$(SLB)$/SYSALLOC_cpprtl.lib
196
197.ENDIF # .IF "$(OS)"=="LINUX"
198
199# --- Coverage -----------------------------------------------------
200# LLA: 20040304 The follows lines are an additional which is only need if we run
201#               coverage tests. For normal test runs this feature is not used.
202#               For more information about coverage tests see:
203#               http://gcc.gnu.org/onlinedocs/gcc-3.0/gcc_8.html
204#
205#               Why this additional?
206#               Anybody has decide to link sal with g++ instead of gcc.
207#
208.IF "$(TESTCOVERAGE)"!=""
209.IF "$(GUI)"=="UNX"
210.IF "$(COM)"=="GCC"
211.IF "$(OS)"=="LINUX"
212SHL1STDLIBS+=-lgcc
213.ENDIF
214.ENDIF
215.ENDIF
216.ENDIF
217
218# --- Targets ------------------------------------------------------
219
220.ENDIF # $(header) != ""
221.ENDIF # $(depend) != ""
222
223.INCLUDE :  target.mk
224
225.IF "$(SHL1TARGETN)" != ""
226$(SHL1TARGETN) : $(OUT)$/inc$/udkversion.h
227.ENDIF # "$(SHL1TARGETN)" != ""
228
229$(OUT)$/inc$/udkversion.h:
230	echo '#ifndef _SAL_UDKVERSION_H_'           >  $@
231	echo '#define _SAL_UDKVERSION_H_'           >> $@
232	echo ''                                     >> $@
233	echo '#define SAL_UDK_MAJOR "$(UDK_MAJOR)"' >> $@
234	echo '#define SAL_UDK_MINOR "$(UDK_MINOR)"' >> $@
235	echo '#define SAL_UDK_MICRO "$(UDK_MICRO)"' >> $@
236	echo ''                                     >> $@
237	echo '#endif'                               >> $@
238