1#************************************************************************* 2# 3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4# 5# Copyright 2000, 2010 Oracle and/or its affiliates. 6# 7# OpenOffice.org - a multi-platform office productivity suite 8# 9# This file is part of OpenOffice.org. 10# 11# OpenOffice.org is free software: you can redistribute it and/or modify 12# it under the terms of the GNU Lesser General Public License version 3 13# only, as published by the Free Software Foundation. 14# 15# OpenOffice.org is distributed in the hope that it will be useful, 16# but WITHOUT ANY WARRANTY; without even the implied warranty of 17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18# GNU Lesser General Public License version 3 for more details 19# (a copy is included in the LICENSE file that accompanied this code). 20# 21# You should have received a copy of the GNU Lesser General Public License 22# version 3 along with OpenOffice.org. If not, see 23# <http://www.openoffice.org/license.html> 24# for a copy of the LGPLv3 License. 25# 26#************************************************************************* 27 28####################################################### 29# instructions for linking 30# unroll begin 31 32.IF "$(GUI)" == "OS2" && "$(TARGETTYPE)" == "GUI" 33APP$(TNR)DEF = $(MISC)/$(APP$(TNR)TARGET).def 34.ENDIF 35 36.IF "$(APP$(TNR)LINKTYPE)" != "" 37#must be either STATIC or SHARED 38APP$(TNR)LINKTYPEFLAG=$(APPLINK$(APP$(TNR)LINKTYPE)) 39.ENDIF 40 41# decide how to link 42.IF "$(APP$(TNR)CODETYPE)"=="C" 43APP$(TNR)LINKER=$(LINKC) 44APP$(TNR)STDLIB=$(subst,CPPRUNTIME, $(STDLIB)) 45APP$(TNR)LINKFLAGS+=$(LINKCFLAGS) 46.ELSE # "$(APP$(TNR)CODETYPE)"=="C" 47APP$(TNR)LINKER=$(LINK) 48APP$(TNR)STDLIB=$(subst,CPPRUNTIME,$(STDLIBCPP) $(STDLIB)) 49APP$(TNR)LINKFLAGS+=$(LINKFLAGS) 50.ENDIF # "$(APP$(TNR)CODETYPE)"=="C" 51 52APP$(TNR)RPATH*=OOO 53LINKFLAGSRUNPATH_$(APP$(TNR)RPATH)*=/ERROR:/Bad_APP$(TNR)RPATH_value 54.IF "$(OS)" != "MACOSX" 55APP$(TNR)LINKFLAGS+=$(LINKFLAGSRUNPATH_$(APP$(TNR)RPATH)) 56.ENDIF 57 58.IF "$(APP$(TNR)STACK)" != "" 59.IF "$(LINKFLAGSTACK)" != "" 60APP$(TNR)STACKN=$(LINKFLAGSTACK)$(APP$(TNR)STACK) 61.ENDIF 62.ELSE 63APP$(TNR)STACKN= 64.ENDIF 65 66.IF "$(APP$(TNR)NOSAL)"=="" 67.IF "$(TARGETTYPE)" == "GUI" 68APP$(TNR)OBJS+= $(STDOBJVCL) 69.ENDIF 70.ENDIF 71 72.IF "$(GUI)$(COM)" == "WNTGCC" 73APP$(TNR)RESO= 74.IF "$(APP$(TNR)LINKRES)" != "" || "$(APP$(TNR)RES)" != "" 75APP$(TNR)RESO=$(MISC)/$(APP$(TNR)TARGET:b)_res.o 76.ENDIF 77.ENDIF 78 79.IF "$(GUI)" == "UNX" 80APP$(TNR)DEPN+:=$(APP$(TNR)DEPNU) 81USE_APP$(TNR)DEF= 82.ENDIF 83 84.IF "$(APP$(TNR)TARGETN)"!="" 85 86.IF "$(APP$(TNR)PRODUCTNAME)"!="" 87APP$(TNR)PRODUCTDEF+:=-DPRODUCT_NAME=\"$(APP$(TNR)PRODUCTNAME)\" 88.ENDIF # "$(APP$(TNR)PRODUCTNAME)"!="" 89 90.IF "$(linkinc)"!="" 91.IF "$(GUI)"=="WNT" || "$(GUI)"=="OS2" 92.IF "$(APP$(TNR)LIBS)"!="" 93$(MISC)/$(APP$(TNR)TARGET)_linkinc.ls .PHONY: 94 @@-$(RM) $@ 95 sed -f $(SOLARENV)/bin/chrel.sed $(foreach,i,$(APP$(TNR)LIBS) $(i:s/.lib/.lin/)) >> $@ 96.ENDIF #"$(APP$(TNR)LIBS)"!="" 97.ENDIF 98 99LINKINCTARGETS+=$(MISC)/$(APP$(TNR)TARGETN:b)_linkinc.ls 100$(APP$(TNR)TARGETN) : $(LINKINCTARGETS) 101.ENDIF # "$(linkinc)"!="" 102 103# Allow for target specific LIBSALCPPRT override 104APP$(TNR)LIBSALCPPRT*=$(LIBSALCPPRT) 105 106.IF "$(GUI)" == "OS2" 107_APP$(TNR)IMP_ORD = $(APP$(TNR)STDLIBS:^"$(SOLARVERSION)/$(INPATH)/lib/") $(APP$(TNR)STDLIBS:^"$(LB)/") 108APP$(TNR)IMP_ORD = $(foreach,i,$(_APP$(TNR)IMP_ORD) $(shell @-ls $i)) 109.ELSE 110APP$(TNR)IMP_ORD = 111.ENDIF 112 113$(APP$(TNR)TARGETN): $(APP$(TNR)OBJS) $(APP$(TNR)LIBS) \ 114 $(APP$(TNR)RES) \ 115 $(APP$(TNR)IMP_ORD) \ 116 $(APP$(TNR)ICON) $(APP$(TNR)DEPN) $(USE_APP$(TNR)DEF) 117 @echo "Making: " $(@:f) 118.IF "$(GUI)"=="UNX" 119.IF "$(OS)"=="MACOSX" 120 @echo unx 121 @-$(RM) $(MISC)/$(@:b).list 122 @-$(RM) $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd 123 @-$(RM) $(MISC)/$(@:b).strip 124 @echo $(STDSLO) $(APP$(TNR)OBJS:s/.obj/.o/) \ 125 `cat /dev/null $(APP$(TNR)LIBS) | sed s\#$(ROUT)\#$(OUT)\#g` | tr -s " " "\n" > $(MISC)/$(@:b).list 126 @echo -n $(APP$(TNR)LINKER) $(APP$(TNR)LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) -o $@ \ 127 $(APP$(TNR)LINKTYPEFLAG) $(APP$(TNR)STDLIBS) $(APP$(TNR)STDLIB) $(STDLIB$(TNR)) -filelist $(MISC)/$(@:b).list > $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd 128 @$(PERL) $(SOLARENV)/bin/macosx-dylib-link-list.pl \ 129 `cat $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd` \ 130 >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd 131 .IF "$(VERBOSE)" == "TRUE" 132 @cat $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd 133 .ENDIF 134 @+source $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd 135# Need to strip __objcInit symbol to avoid duplicate symbols when loading 136# libraries at runtime 137 @-nm $@ | grep -v ' U ' | $(AWK) '{ print $$NF }' | grep -F -x '__objcInit' > $(MISC)/$(@:b).strip 138 @strip -i -R $(MISC)/$(@:b).strip -X $@ 139 @ls -l $@ 140 @$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl \ 141 app $(APP$(TNR)RPATH) $@ 142.IF "$(TARGETTYPE)"=="GUI" 143 @echo "Making: " $(@:f).app 144 @macosx-create-bundle $@ 145.ENDIF # "$(TARGETTYPE)"=="GUI" 146.ELSE # "$(OS)"=="MACOSX" 147 @echo unx 148 @-$(RM) $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd 149 @echo $(APP$(TNR)LINKER) $(APP$(TNR)LINKFLAGS) $(LINKFLAGSAPP) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \ 150 $(APP$(TNR)OBJS:s/.obj/.o/) '\' > $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd 151 @cat $(mktmp /dev/null $(APP$(TNR)LIBS)) | xargs -n 1 cat | sed s\#$(ROUT)\#$(OUT)\#g | sed 's#$$# \\#' >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd 152 @echo $(APP$(TNR)LINKTYPEFLAG) $(APP$(TNR)LIBSALCPPRT) $(APP$(TNR)STDLIBS) $(APP$(TNR)STDLIB) $(STDLIB$(TNR)) -o $@ >> $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd 153 .IF "$(VERBOSE)" == "TRUE" 154 @cat $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd 155 .ENDIF 156 @+source $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd 157 .IF "$(VERBOSE)" == "TRUE" 158 @ls -l $@ 159 .ENDIF 160.ENDIF # "$(OS)"=="MACOSX" 161.ENDIF 162.IF "$(GUI)" == "WNT" 163 @@-$(MKDIR) $(@:d:d) 164.IF "$(APP$(TNR)LINKRES)" != "" 165 @@-$(RM) $(MISC)/$(APP$(TNR)LINKRES:b).rc 166.IF "$(APP$(TNR)ICON)" != "" 167 @-echo 1 ICON $(EMQ)"$(APP$(TNR)ICON:s/\/\\/)$(EMQ)" >> $(MISC)/$(APP$(TNR)LINKRES:b).rc 168.ENDIF # "$(APP$(TNR)ICON)" != "" 169.IF "$(APP$(TNR)VERINFO)" != "" 170 @-echo $(EMQ)#define VERVARIANT $(BUILD) >> $(MISC)/$(APP$(TNR)LINKRES:b).rc 171 @-echo $(EMQ)#include $(EMQ)"$(APP$(TNR)VERINFO)$(EMQ)" >> $(MISC)/$(APP$(TNR)LINKRES:b).rc 172.ENDIF # "$(APP$(TNR)VERINFO)" != "" 173 $(COMMAND_ECHO)$(RC) -DWIN32 $(APP$(TNR)PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP$(TNR)LINKRES:b).rc 174.ENDIF # "$(APP$(TNR)LINKRES)" != "" 175.IF "$(COM)" == "GCC" 176 @echo mingw 177.IF "$(APP$(TNR)LINKRES)" != "" || "$(APP$(TNR)RES)" != "" 178 @cat $(APP$(TNR)LINKRES) $(subst,/res/,/res{$(subst,$(BIN), $(@:d))} $(APP$(TNR)RES)) > $(MISC)/$(@:b)_all.res 179 windres $(MISC)/$(@:b)_all.res $(APP$(TNR)RESO) 180.ENDIF 181 @echo $(LINK) $(LINKFLAGS) $(LINKFLAGSAPP) $(MINGWSSTDOBJ) -L$(PRJ)/$(INPATH)/lib $(SOLARLIB) $(STDSLO) \ 182 $(APP$(TNR)BASEX) $(APP$(TNR)STACKN) -o $@ $(APP$(TNR)OBJS) \ 183 -Wl,-Map,$(MISC)/$(@:b).map $(STDOBJ) $(APP$(TNR)RESO) \ 184 `$(TYPE) /dev/null $(APP$(TNR)LIBS) | sed s#$(ROUT)#$(OUT)#g` \ 185 $(APP_LINKTYPE) $(APP$(TNR)LIBSALCPPRT) \ 186 -Wl,--start-group $(APP$(TNR)STDLIBS) -Wl,--end-group $(APP$(TNR)STDLIB) \ 187 $(STDLIB$(TNR)) $(MINGWSSTDENDOBJ) > $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd 188 # need this empty line, else dmake somehow gets confused by the .IFs and .ENDIFs 189 .IF "$(VERBOSE)" == "TRUE" 190 @$(TYPE) $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd 191 .ENDIF 192 @+source $(MISC)/$(TARGET).$(@:b)_$(TNR).cmd 193 @ls -l $@ 194.ELSE # "$(COM)" == "GCC" 195.IF "$(linkinc)" == "" 196 $(COMMAND_ECHO)$(APP$(TNR)LINKER) @$(mktmp \ 197 $(APP$(TNR)LINKFLAGS) \ 198 $(LINKFLAGSAPP) $(APP$(TNR)BASEX) \ 199 $(APP$(TNR)STACKN) \ 200 -out:$@ \ 201 -map:$(MISC)/{$(subst,/,_ $(APP$(TNR)TARGET)).map} \ 202 $(STDOBJ) \ 203 $(APP$(TNR)LINKRES) \ 204 $(APP$(TNR)RES) \ 205 $(APP$(TNR)OBJS) \ 206 $(APP$(TNR)LIBS) \ 207 $(APP$(TNR)STDLIBS) \ 208 $(APP$(TNR)STDLIB) $(STDLIB$(TNR)) \ 209 ) 210 @-echo linking $@.manifest ... 211.IF "$(VISTA_MANIFEST)"!="" 212 $(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -manifest $(TRUSTED_MANIFEST_LOCATION)/trustedinfo.manifest -out:$@.tmanifest$(EMQ) $(FI) 213 $(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.tmanifest -outputresource:$@$(EMQ);1 $(FI) 214.ELSE 215 $(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(MT) $(MTFLAGS) -manifest $@.manifest -outputresource:$@$(EMQ);1 $(FI) 216.ENDIF # "$(VISTA_MANIFEST)"!="" 217 $(COMMAND_ECHO)$(IFEXIST) $@.manifest $(THEN) $(RM:s/+//) $@.manifest $(FI) 218 $(COMMAND_ECHO)$(IFEXIST) $@.tmanifest $(THEN) $(RM:s/+//) $@.tmanifest $(FI) 219.ELSE 220 $(COMMAND_ECHO)-$(RM) $(MISC)\$(APP$(TNR)TARGET).lnk 221 $(COMMAND_ECHO)-$(RM) $(MISC)\$(APP$(TNR)TARGET).lst 222 $(COMMAND_ECHO)-$(RM) $(MISC)\linkobj.lst 223 for %_i in ($(MISC)\*.obj) do type %_i >> $(MISC)\linkobj.lst 224 type $(mktmp,$(MISC)\$(APP$(TNR)TARGET).lst 225 $(APP$(TNR)LINKFLAGS) \ 226 $(LINKFLAGSAPP) $(APP$(TNR)BASEX) \ 227 $(APP$(TNR)STACKN) \ 228 -out:$@ \ 229 $(STDOBJ) \ 230 $(APP$(TNR)LINKRES) \ 231 $(APP$(TNR)RES) \ 232 $(APP$(TNR)OBJS) \ 233 $(APP$(TNR)LIBS) \ 234 $(APP$(TNR)STDLIBS) \ 235 $(APP$(TNR)STDLIB) $(STDLIB$(TNR))) 236 $(COMMAND_ECHO)$(SED)$(SED) -e 's/\(\.\.\\\)\{2,4\}/..\\/g' $(MISC)\$(APP$(TNR)TARGETN:b)_linkobj.lst >> $(MISC)\$(APP$(TNR)TARGET).lst 237 $(COMMAND_ECHO)$(SED)$(IFEXIST) $(MISC)/$(APP$(TNR)TARGET).lst $(THEN) type $(MISC)/$(APP$(TNR)TARGET).lst >> $(MISC)/$(APP$(TNR)TARGET).lnk $(FI) 238 $(COMMAND_ECHO)$(SED)$(APP$(TNR)LINKER) @$(MISC)\$(APP$(TNR)TARGET).lnk 239.ENDIF # "$(linkinc)" == "" 240.ENDIF # "$(COM)" == "GCC" 241.IF "$(APP$(TNR)TARGET)" == "loader" 242 $(COMMAND_ECHO)$(PERL) loader.pl $@ 243 $(COMMAND_ECHO)$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe 244 $(COMMAND_ECHO)$(RM) $@ 245 $(COMMAND_ECHO)$(RENAME) $(@:d)_new.exe $(@:d)loader.exe 246.ENDIF # "$(TARGET)" == "setup" 247 248.ENDIF # "$(GUI)" == "WNT" 249 250.IF "$(GUI)" == "OS2" 251 @+-$(MKDIR) $(@:d:d) >& $(NULLDEV) 252.IF "$(APP$(TNR)LINKRES)" != "" 253 @+-$(RM) $(MISC)/$(APP$(TNR)LINKRES:b).rc >& $(NULLDEV) 254.IF "$(APP$(TNR)ICON)" != "" 255 @-+$(WRAPCMD) echo 1 ICON $(EMQ)"$(APP$(TNR)ICON)$(EMQ)" | $(SED) 'sX\\X\\\\Xg' >> $(MISC)/$(APP$(TNR)LINKRES:b).rc 256.ENDIF # "$(APP$(TNR)ICON)" != "" 257.IF "$(APP$(TNR)VERINFO)" != "" 258 @-+echo $(EMQ)#define VERVARIANT $(BUILD) >> $(MISC)/$(APP$(TNR)LINKRES:b).rc 259 @-+echo $(EMQ)#include $(EMQ)"$(APP$(TNR)VERINFO)$(EMQ)" >> $(MISC)/$(APP$(TNR)LINKRES:b).rc 260.ENDIF # "$(APP$(TNR)VERINFO)" != "" 261 $(COMMAND_ECHO)$(RC) -r -DOS2 $(APP$(TNR)PRODUCTDEF) -I$(SOLARRESDIR) $(INCLUDE) $(RCLINKFLAGS) $(MISC)/$(APP$(TNR)LINKRES:b).rc 262.ENDIF # "$(APP$(TNR)LINKRES)" != "" 263 264.IF "$(TARGETTYPE)" == "GUI" 265 @echo NAME $(APP$(TNR)TARGET) WINDOWAPI > $(MISC)/$(APP$(TNR)TARGET).def 266.ENDIF 267 268 .IF "$(VERBOSE)" == "TRUE" 269 @+echo $(APP$(TNR)LINKFLAGS) \ 270 $(LINKFLAGSAPP) $(APP$(TNR)BASEX) \ 271 $(APP$(TNR)STACKN) \ 272 -o $@ \ 273 -Zmap -L$(LB) \ 274 -L$(SOLARVERSION)/$(INPATH)/lib \ 275 $(STDOBJ) \ 276 $(APP$(TNR)LINKRES) \ 277 $(APP$(TNR)RES) \ 278 $(APP$(TNR)DEF) \ 279 $(APP$(TNR)OBJS) \ 280 $(APP$(TNR)LIBS) \ 281 $(APP$(TNR)STDLIBS:^"-l") \ 282 $(APP$(TNR)STDLIB:^"-l") $(STDLIB$(TNR):^"-l") 283 .ENDIF 284 $(COMMAND_ECHO)$(APP$(TNR)LINKER) -v \ 285 $(APP$(TNR)LINKFLAGS) \ 286 $(LINKFLAGSAPP) $(APP$(TNR)BASEX) \ 287 $(APP$(TNR)STACKN) \ 288 -o $@ \ 289 -Zmap -L$(LB) \ 290 -L$(SOLARVERSION)/$(INPATH)/lib \ 291 $(STDOBJ) \ 292 $(APP$(TNR)LINKRES) \ 293 $(APP$(TNR)RES) \ 294 $(APP$(TNR)DEF) \ 295 $(APP$(TNR)OBJS) \ 296 $(APP$(TNR)LIBS) \ 297 $(APP$(TNR)STDLIBS:^"-l") \ 298 $(APP$(TNR)STDLIB:^"-l") $(STDLIB$(TNR):^"-l") 299 300 301.IF "$(APP$(TNR)TARGET)" == "loader" 302 $(COMMAND_ECHO)+$(PERL) loader.pl $@ 303 $(COMMAND_ECHO)+$(TYPE) $(@) $(@:d)unloader.exe > $(@:d)_new.exe 304 $(COMMAND_ECHO)+$(RM) $@ 305 $(COMMAND_ECHO)+$(RENAME) $(@:d)_new.exe $(@:d)loader.exe 306.ENDIF # "$(TARGET)" == "setup" 307 308.ENDIF # "$(GUI)" == "OS2" 309 310.ENDIF # "$(APP$(TNR)TARGETN)"!="" 311 312 313# Instruction for linking 314# unroll end 315####################################################### 316 317