summaryrefslogtreecommitdiff
path: root/data/ld64/makefile.diff
blob: a8775e620019a711fdc18a2810d13a505b843566 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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="11.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)