diff -uNr ld64-274.2/Makefile ld64-274.2+iPhone/Makefile --- ld64-274.2/Makefile 1969-12-31 14:00:00.000000000 -1000 +++ ld64-274.2+iPhone/Makefile 2018-09-05 22:32:02.000000000 -1000 @@ -0,0 +1,55 @@ +SUBDIRS = src +OTHERS = $(patsubst src/other/%.cpp,%,$(filter-out src/other/PruneTrie.cpp src/other/objcimageinfo.cpp, $(wildcard src/other/*.cpp))) +BINS = ld64 $(OTHERS) +LIBS = libprunetrie.a +DEPS = include/configure.h include/compile_stubs.h +LD_SOURCES = $(wildcard src/ld/*.cpp src/ld/*.c src/ld/parsers/*.cpp src/ld/passes/*.cpp src/ld/passes/stubs/*.cpp) +LD_OBJS = $(patsubst %.c,%.c.o,$(patsubst %.cpp,%.cpp.o,$(LD_SOURCES))) +DERIVED_FILE_DIR = include + +.PHONY: all + +all: $(LIBS) $(BINS) + +include: + mkdir include + +include/configure.h: include + DERIVED_FILE_DIR="$(DERIVED_FILE_DIR)" IPHONEOS_DEPLOYMENT_TARGET="7.0" src/create_configure + +include/compile_stubs.h: include + echo "static const char *compile_stubs = " > $(DERIVED_FILE_DIR)/compile_stubs.h + cat compile_stubs | sed s/\"/\\\\\"/g | sed s/^/\"/ | sed s/\$$/\\\\n\"/ >> $(DERIVED_FILE_DIR)/compile_stubs.h + echo ";" >> $(DERIVED_FILE_DIR)/compile_stubs.h + +$(LD_OBJS): $(DEPS) + +%.cpp.o: %.cpp + $(CXX) -std=c++11 -o $@ -c $< -Isrc/abstraction -I$(DERIVED_FILE_DIR) -Isrc/ld/parsers -Isrc/ld -DVERSION=\"$(VERSION)\" + +%.c.o: %.c + $(CC) -o $@ -c $< -Isrc/abstraction -I$(DERIVED_FILE_DIR) -Isrc/ld/parsers -Isrc/ld -DVERSION=\"$(VERSION)\" + +ld64: $(LD_OBJS) + $(CXX) -o $@ $^ $(LDFLAGS) -ltapi -lLTO -lxar + +libld64.a: $(filter-out src/ld/ld.cpp.o, $(LD_OBJS)) + ar -r libld64.a $^ + +$(OTHERS): % : src/other/%.cpp libld64.a + $(CXX) -std=c++11 -o $@ $^ $(LDFLAGS) -ltapi -lLTO -lxar -Isrc/abstraction -I$(DERIVED_FILE_DIR) -Isrc/ld/parsers -Isrc/ld + +libprunetrie.a: src/other/PruneTrie.cpp.o + ar -r libprunetrie.a $^ + +install: + mkdir -p $(DESTDIR)/usr/{bin,lib,include/mach-o} + cp $(BINS) $(DESTDIR)/usr/bin/ + cp $(LIBS) $(DESTDIR)/usr/lib/ + cp src/other/prune_trie.h $(DESTDIR)/usr/include/mach-o/ + +clean: + rm -f $(BINS) $(LIBS) $(LD_OBJS) libld64.a src/other/PruneTrie.cpp.o + +distclean: clean + rm -rf $(DERIVED_FILE_DIR)