llvm.org GIT mirror llvm / a15dc03
Remove libtool. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65517 91177308-0d34-0410-b5e6-96231b3b80d8 Nick Lewycky 10 years ago
4 changed file(s) with 73 addition(s) and 84 deletion(s). Raw diff Collapse all Expand all
4040 # Reset the list of suffixes we know how to build.
4141 #--------------------------------------------------------------------
4242 .SUFFIXES:
43 .SUFFIXES: .c .cpp .cc .h .hpp .lo .o .a .bc .td .ps .dot .ll
43 .SUFFIXES: .c .cpp .cc .h .hpp .o .a .bc .td .ps .dot .ll
4444 .SUFFIXES: $(SHLIBEXT) $(SUFFIXES)
4545
4646 #--------------------------------------------------------------------
276276 CPP.Defines += -D_GLIBCXX_DEBUG -DXDEBUG
277277 endif
278278
279 # LOADABLE_MODULE implies several other things so we force them to be
280 # defined/on.
281 ifdef LOADABLE_MODULE
282 SHARED_LIBRARY := 1
283 DONT_BUILD_RELINKED := 1
284 LINK_LIBS_IN_SHARED := 1
285 endif
286
287 ifdef SHARED_LIBRARY
288 ENABLE_PIC := 1
289 PIC_FLAG = "(PIC)"
290 endif
291
279292 ifeq ($(ENABLE_PIC),1)
280293 ifeq ($(LLVM_ON_WIN32),1)
281294 # Nothing. Win32 defaults to PIC and warns when given -fPIC
282295 else
283296 ifeq ($(OS),Darwin)
284 # common is forbidden in dylib files
297 # Common symbols not allowed in dylib files
285298 CXX.Flags += -fno-common
286299 C.Flags += -fno-common
287300 else
298311 CPP.BaseFlags += $(CPP.Defines)
299312 LD.Flags += $(LDFLAGS)
300313 AR.Flags := cru
301 LibTool.Flags := --tag=CXX
302314
303315 # Make Floating point IEEE compliant on Alpha.
304316 ifeq ($(ARCH),Alpha)
337349 #--------------------------------------------------------------------
338350 EchoCmd = $(ECHO) llvm[$(MAKELEVEL)]:
339351 Echo = @$(EchoCmd)
340 ifndef LIBTOOL
341 LIBTOOL := $(LLVM_OBJ_ROOT)/mklib
342 endif
343352 ifndef LLVMAS
344353 LLVMAS := $(LLVMToolDir)/llvm-as$(EXEEXT)
345354 endif
388397 # Adjust to user's request
389398 #--------------------------------------------------------------------
390399
391 # Adjust LD.Flags and Libtool.Flags depending on the kind of library that is
392 # to be built. Note that if LOADABLE_MODULE is specified then the resulting
393 # shared library can be opened with dlopen. Also, LOADABLE_MODULE implies
394 # several other things so we force them to be defined/on.
400 # Adjust LD.Flags depending on the kind of library that is to be built. Note
401 # that if LOADABLE_MODULE is specified then the resulting shared library can
402 # be opened with dlopen.
395403 ifdef LOADABLE_MODULE
396 SHARED_LIBRARY := 1
397 DONT_BUILD_RELINKED := 1
398 LINK_LIBS_IN_SHARED := 1
399404 LD.Flags += -module
400405 endif
401406
402407 ifdef SHARED_LIBRARY
403 LD.Flags += -rpath $(LibDir)
404 else
405 LibTool.Flags += --tag=disable-shared
408 LD.Flags += -Wl,-rpath -Wl,$(LibDir)
406409 endif
407410
408411 ifdef TOOL_VERBOSE
415418 # Adjust settings for verbose mode
416419 ifndef VERBOSE
417420 Verb := @
418 LibTool.Flags += --silent
419421 AR.Flags += >/dev/null 2>/dev/null
420422 ConfigureScriptFLAGS += >$(PROJ_OBJ_DIR)/configure.out 2>&1
421423 else
430432 endif
431433
432434 # Adjust linker flags for building an executable
435 ifndef ($(OS),Darwin)
433436 ifdef TOOLNAME
434437 ifdef EXAMPLE_TOOL
435 LD.Flags += -rpath $(ExmplDir) -export-dynamic
436 else
437 LD.Flags += -rpath $(ToolDir) -export-dynamic
438 endif
438 LD.Flags += -Wl,-rpath -Wl,$(ExmplDir) -export-dynamic
439 else
440 LD.Flags += -Wl,-rpath -Wl,$(ToolDir) -export-dynamic
441 endif
442 endif
443 endif
444
445 ifeq ($(OS),Darwin)
446 SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined -Wl,suppress -bundle
447 else
448 SharedLinkOptions=-shared
439449 endif
440450
441451 #----------------------------------------------------------
507517 $(Relink.Flags)
508518 endif
509519
510 LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
511520 BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts)
512521 Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) -E
513522
514 LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
515523 BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CXX.Flags) \
516524 $(CompileCommonOpts)
517525
518 LTLink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(Link)
519 LTRelink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(Relink)
520 LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL) \
521 $(Install.Flags)
522526 ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
523527 ScriptInstall = $(INSTALL) -m 0755
524528 DataInstall = $(INSTALL) -m 0644
558562 BaseNameSources := $(sort $(basename $(Sources)))
559563
560564 ObjectsO := $(BaseNameSources:%=$(ObjDir)/%.o)
561 ObjectsLO := $(BaseNameSources:%=$(ObjDir)/%.lo)
562565 ObjectsBC := $(BaseNameSources:%=$(ObjDir)/%.bc)
563566
564567 ###############################################################################
826829 # Make sure there isn't any extranous whitespace on the LIBRARYNAME option
827830 LIBRARYNAME := $(strip $(LIBRARYNAME))
828831 ifdef LOADABLE_MODULE
829 LibName.LA := $(LibDir)/$(LIBRARYNAME).la
830 else
831 LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
832 endif
832 LibName.A := $(LibDir)/$(LIBRARYNAME).a
833 LibName.SO := $(LibDir)/$(LIBRARYNAME)$(SHLIBEXT)
834 else
833835 LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
836 LibName.SO := $(LibDir)/lib$(LIBRARYNAME)$(SHLIBEXT)
837 endif
834838 LibName.O := $(LibDir)/$(LIBRARYNAME).o
835839 LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
836840
842846 #---------------------------------------------------------
843847 ifdef SHARED_LIBRARY
844848
845 all-local:: $(LibName.LA)
849 all-local:: $(LibName.SO)
846850
847851 ifdef LINK_LIBS_IN_SHARED
848852 ifdef LOADABLE_MODULE
850854 else
851855 SharedLibKindMessage := "Shared Library"
852856 endif
853 $(LibName.LA): $(ObjectsLO) $(ProjLibsPaths) $(LLVMLibsPaths) $(LibDir)/.dir
857 $(LibName.SO): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths) $(LibDir)/.dir
854858 $(Echo) Linking $(BuildMode) $(SharedLibKindMessage) \
855859 $(LIBRARYNAME)$(SHLIBEXT)
856 $(Verb) $(LTLink) -o $@ $(ObjectsLO) $(ProjLibsOptions) \
857 $(LLVMLibsOptions)
858 $(Verb) $(LTInstall) $@ $(LibDir)
859 else
860 $(LibName.LA): $(ObjectsLO) $(LibDir)/.dir
860 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO) \
861 $(ProjLibsOptions) $(LLVMLibsOptions)
862 else
863 $(LibName.SO): $(ObjectsO) $(LibDir)/.dir
861864 $(Echo) Linking $(BuildMode) Shared Library $(LIBRARYNAME)$(SHLIBEXT)
862 $(Verb) $(LTLink) -o $@ $(ObjectsLO)
863 $(Verb) $(LTInstall) $@ $(LibDir)
865 $(Verb) $(Link) $(SharedLinkOptions) -o $@ $(ObjectsO)
864866 endif
865867
866868 clean-local::
867 ifneq ($(strip $(LibName.LA)),)
868 -$(Verb) $(RM) -f $(LibName.LA)
869 ifneq ($(strip $(LibName.SO)),)
870 -$(Verb) $(RM) -f $(LibName.SO)
869871 endif
870872
871873 ifdef NO_INSTALL
878880
879881 install-local:: $(DestSharedLib)
880882
881 $(DestSharedLib): $(LibName.LA) $(PROJ_libdir)
883 $(DestSharedLib): $(LibName.SO) $(PROJ_libdir)
882884 $(Echo) Installing $(BuildMode) Shared Library $(DestSharedLib)
883 $(Verb) $(LTInstall) $(LibName.LA) $(DestSharedLib)
884 $(Verb) $(LIBTOOL) --finish $(PROJ_libdir)
885 $(Verb) $(INSTALL) $(LibName.SO) $(DestSharedLib)
885886
886887 uninstall-local::
887888 $(Echo) Uninstalling $(BuildMode) Shared Library $(DestSharedLib)
975976
976977 $(LibName.O): $(ObjectsO) $(LibDir)/.dir
977978 $(Echo) Linking $(BuildMode) Object Library $(notdir $@)
978 $(Verb) $(LTRelink) -o $@ $(ObjectsO)
979 $(Verb) $(Relink) -Wl,-r -nodefaultlibs -nostdlibs -nostartfiles -o $@ $(ObjectsO)
979980
980981 clean-local::
981982 ifneq ($(strip $(LibName.O)),)
994995
995996 $(DestRelinkedLib): $(LibName.O) $(PROJ_libdir)
996997 $(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib)
997 $(Verb) $(LTInstall) $(LibName.O) $(DestRelinkedLib)
998 $(Verb) $(INSTALL) $(LibName.O) $(DestRelinkedLib)
998999
9991000 uninstall-local::
10001001 $(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib)
10351036 $(DestArchiveLib): $(LibName.A) $(PROJ_libdir)
10361037 $(Echo) Installing $(BuildMode) Archive Library $(DestArchiveLib)
10371038 $(Verb) $(MKDIR) $(PROJ_libdir)
1038 $(Verb) $(LTInstall) $(LibName.A) $(DestArchiveLib)
1039 $(Verb) $(INSTALL) $(LibName.A) $(DestArchiveLib)
10391040
10401041 uninstall-local::
10411042 $(Echo) Uninstalling $(BuildMode) Archive Library $(DestArchiveLib)
10791080
10801081 $(ToolBuildPath): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
10811082 $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg)
1082 $(Verb) $(LTLink) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
1083 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
10831084 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
10841085 $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \
10851086 $(StripWarnMsg)
11131114 DISABLE_AUTO_DEPENDENCIES=1
11141115 endif
11151116
1116 ifdef SHARED_LIBRARY
1117 PIC_FLAG = "(PIC)"
1118 MAYBE_PIC_Compile.CXX = $(LTCompile.CXX)
1119 MAYBE_PIC_Compile.C = $(LTCompile.C)
1120 else
1121 MAYBE_PIC_Compile.CXX = $(Compile.CXX)
1122 MAYBE_PIC_Compile.C = $(Compile.C)
1123 endif
1124
11251117 # Provide rule sets for when dependency generation is enabled
11261118 ifndef DISABLE_AUTO_DEPENDENCIES
11271119
11281120 #---------------------------------------------------------
1129 # Create .lo files in the ObjDir directory from the .cpp and .c files...
1121 # Create .o files in the ObjDir directory from the .cpp and .c files...
11301122 #---------------------------------------------------------
11311123
11321124 DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
1133 -MT "$(ObjDir)/$*.lo" -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
1125 -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
11341126
11351127 # If the build succeeded, move the dependency file over. If it failed, put an
11361128 # empty file there.
11371129 DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
11381130 else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
11391131
1140 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1132 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
11411133 $(Echo) "Compiling $*.cpp for $(BuildMode) build " $(PIC_FLAG)
1142 $(Verb) if $(MAYBE_PIC_Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1134 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
11431135 $(DEPEND_MOVEFILE)
11441136
1145 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1137 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
11461138 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1147 $(Verb) if $(MAYBE_PIC_Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1139 $(Verb) if $(Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
11481140 $(DEPEND_MOVEFILE)
11491141
1150 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1142 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
11511143 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1152 $(Verb) if $(MAYBE_PIC_Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
1144 $(Verb) if $(Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
11531145 $(DEPEND_MOVEFILE)
11541146
11551147 #---------------------------------------------------------
11861178 # Provide alternate rule sets if dependencies are disabled
11871179 else
11881180
1189 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
1181 $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
11901182 $(Echo) "Compiling $*.cpp for $(BuildMode) build" $(PIC_FLAG)
1191 $(MAYBE_PIC_Compile.CXX) $< -o $@
1192
1193 $(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
1183 $(Compile.CXX) $< -o $@
1184
1185 $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
11941186 $(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
1195 $(MAYBE_PIC_Compile.CXX) $< -o $@
1196
1197 $(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
1187 $(Compile.CXX) $< -o $@
1188
1189 $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
11981190 $(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
1199 $(MAYBE_PIC_Compile.C) $< -o $@
1191 $(Compile.C) $< -o $@
12001192
12011193 $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(LLVMGXX)
12021194 $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)"
12351227
12361228 $(ObjDir)/%.s: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
12371229 $(Echo) "Compiling $*.cpp to asm for $(BuildMode) build" $(PIC_FLAG)
1238 $(MAYBE_PIC_Compile.CXX) $< -o $@ -S
1230 $(Compile.CXX) $< -o $@ -S
12391231
12401232 $(ObjDir)/%.s: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
12411233 $(Echo) "Compiling $*.cc to asm for $(BuildMode) build" $(PIC_FLAG)
1242 $(MAYBE_PIC_Compile.CXX) $< -o $@ -S
1234 $(Compile.CXX) $< -o $@ -S
12431235
12441236 $(ObjDir)/%.s: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
12451237 $(Echo) "Compiling $*.c to asm for $(BuildMode) build" $(PIC_FLAG)
1246 $(MAYBE_PIC_Compile.C) $< -o $@ -S
1238 $(Compile.C) $< -o $@ -S
12471239
12481240
12491241 # make the C and C++ compilers strip debug info out of bytecode libraries.
130130 install-a:: $(LibraryA)
131131 $(Echo) "Installing $(BuildMode) $(DestA)"
132132 $(Verb) $(MKDIR) $(PROJ_libocamldir)
133 $(Verb) $(LTInstall) $(LibraryA) $(DestA)
133 $(Verb) $(INSTALL) $(LibraryA) $(DestA)
134134 $(Verb)
135135
136136 uninstall-a::
989989 LLVMToolDir
990990 LLVMUsedLibs
991991 LocalTargets
992 LTCompile.C
993 LTCompile.CXX
994 LTInstall
995992 Module
996993 ObjectsBC
997994 ObjectsLO
2020
2121 CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest/include/
2222 CPP.Flags += -Wno-variadic-macros
23 LD.Flags += -lGoogleTest -lUnitTestMain
23 LIBS += -lGoogleTest -lUnitTestMain
2424
2525 $(LLVMUnitTestExe): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
2626 $(Echo) Linking $(BuildMode) unit test $(TESTNAME) $(StripWarnMsg)
27 $(Verb) $(LTLink) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
27 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
2828 $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS)
2929 $(Echo) ======= Finished Linking $(BuildMode) Unit test $(TESTNAME) \
3030 $(StripWarnMsg)