CPPFLAGS += -Iinclude -Iabstraction -Ild -Ild/parsers -Iother -I. # some files generate warnings about applying offsetof to a non-POD type. # Upstream seems aware of that and ignores by setting # GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = NO in the xcode project. CXXFLAGS += -Wno-invalid-offsetof # ld64 now uses C++11 language features but upstream Xcode project enables only # c++0x CXXFLAGS += -std=c++0x # ld64 can nowadays only be compiled with libc++ and clang++ CXXFLAGS += -stdlib=libc++ ifeq ($(LTO),1) CPPFLAGS += -DLTO -I$(LTO_INCDIR) LTO_OBJ = ld/parsers/lto_file.o # Current clang has all libraries use @rpath in their install name. An rpath # potentially present in the library does not propagate to a binary upon # linkling. So we need to set an rpath where those libraries can later actually # be found. LIBLTO_LDFLAGS = -Wl,-rpath,$(LTO_LIBDIR) LIBLTO_LIBS = -L$(LTO_LIBDIR) -lLTO -lxar else LTO_OBJ = LIBLTO_LDFLAGS = LIBLTO_LIBS = endif ifeq ($(TAPI),1) CPPFLAGS += -DTAPI TAPI_OBJ = ld/parsers/textstub_dylib_file.o TAPI_LDFLAGS = -Wl,-rpath,$(TAPI_LIBDIR) # our binary is ld64, but bootstraping with any other tapi requires "ld" TAPI_LDFLAGS += -client_name ld TAPI_LIBS = -L$(TAPI_LIBDIR) -ltapi else TAPI_LDFLAGS = TAPI_OBJ = TAPI_LIBS = endif SHARED_OBJECTS = ld/debugline.o ld/parsers/macho_relocatable_file.o all: unwinddump dyldinfo ld64 ObjectDump objcimageinfo machocheck libprunetrie.a: other/PruneTrie.o other/prune_trie.h $(AR) -s -r -c libprunetrie.a other/PruneTrie.o # there are rules that use gcc for c, and clang for cpp. ld64: libprunetrie.a \ version.o \ ld/parsers/archive_file.o \ ld/parsers/opaque_section_file.o \ ld/parsers/macho_dylib_file.o \ ld/passes/branch_island.o \ ld/passes/dylibs.o \ ld/passes/order.o \ ld/passes/branch_shim.o \ ld/passes/got.o \ ld/passes/tlvp.o \ ld/passes/compact_unwind.o \ ld/passes/huge.o \ ld/passes/dtrace_dof.o \ ld/passes/objc.o \ ld/passes/stubs/stubs.o \ ld/InputFiles.o \ ld/OutputFile.o \ ld/SymbolTable.o \ ld/Snapshot.o \ ld/Options.o \ ld/Resolver.o \ ld/ld.o \ ld/passes/bitcode_bundle.o \ ld/passes/code_dedup.o \ ld/passes/inits.o \ ld/passes/thread_starts.o \ ld/PlatformSupport.o \ ld/code-sign-blobs/blob.o \ $(SHARED_OBJECTS) \ $(LTO_OBJ) $(TAPI_OBJ) $(CXX) $(CXXFLAGS) $(LIBLTO_LDFLAGS) $(TAPI_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBLTO_LIBS) $(TAPI_LIBS) dyldinfo: other/dyldinfo.o $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ unwinddump: other/unwinddump.o $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ # Apple only includes this in unit-tests, but can be used elsewhere ObjectDump: other/ObjectDump.o ld/PlatformSupport.o $(SHARED_OBJECTS) $(LTO_OBJ) $(CXX) $(CXXFLAGS) $(LIBLTO_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBLTO_LIBS) # Apple only includes this in unit-tests, but can be used elsewhere objcimageinfo: other/objcimageinfo.o $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ machocheck: other/machochecker.o $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^