Debian Codegraph @

format/apple/macho/testdata/Makefile

raw
1 TARGETS=libbbb.o libbbb.so a.o a_dynamic a_stripped a_static
2 GENERATED_FILES=$(TARGETS) libbbb.a
3
4 FQ:=fq
5
6 all: $(TARGETS)
7
8 all-platforms:
9 make build DIR=darwin_amd64 CFLAGS='-target x86_64-apple-macos10.12'
10 make build CC=clang DIR=darwin_aarch64 CFLAGS='-target arm64-apple-macos11'
11 make build_fat_targets DIR=darwin_fat DIR_X86=darwin_amd64 DIR_ARM=darwin_aarch64
12
13 clean:
14 rm -f $(TARGETS)
15
16 build:
17 make
18 mkdir -p $(DIR)
19 mv $(GENERATED_FILES) $(DIR)
20 rm $(DIR)/*.o
21
22 build_fat_targets:
23 mkdir -p $(DIR)
24 make build_fat DIR=$(DIR) OUTPUT=a_dynamic TARGET_X86=$(DIR_X86)/a_dynamic TARGET_ARM=$(DIR_ARM)/a_dynamic
25 make build_fat DIR=$(DIR) OUTPUT=a_static TARGET_X86=$(DIR_X86)/a_static TARGET_ARM=$(DIR_ARM)/a_static
26 make build_fat DIR=$(DIR) OUTPUT=libbbb.so TARGET_X86=$(DIR_X86)/libbbb.so TARGET_ARM=$(DIR_ARM)/libbbb.so
27 make build_fat DIR=$(DIR) OUTPUT=a_stripped TARGET_X86=$(DIR_X86)/a_stripped TARGET_ARM=$(DIR_ARM)/a_stripped
28
29 # build_fat creates a FAT binary from TARGET_X86 and TARGET_ARM
30 # creates FAT binary $(OUTPUT) under $(DIR)
31 build_fat:
32 lipo -create -output $(DIR)/$(OUTPUT) $(TARGET_X86) $(TARGET_ARM)
33
34 libbbb.so: libbbb.o
35 $(CC) $(CFLAGS) -shared -o $@ $+
36 libbbb.a: libbbb.o
37 ar ru $@ $+
38 ranlib $@
39 a_dynamic: a.o
40 $(CC) $(CFLAGS) -o $@ $+ -L./ -lbbb
41 a_stripped: a_dynamic
42 strip -o $@ $<
43 a_static: a.o libbbb.a
44 $(CC) $(CFLAGS) -o $@ $+ libbbb.a
45
46 all-platforms-actual:
47 make actual DIR=darwin_amd64
48 make actual DIR=darwin_aarch64
49 make actual DIR=darwin_fat
50
51 # generates or actualizes the test cases
52 actual:
53 cd $(DIR) && echo $(TARGETS) | tr -s '[:blank:]' '\n' | grep -ivE '.*\.o$$' | xargs -I '{}' sh -c 'echo "$$ fq dv {}" > {}.fqtest && $(FQ) -d macho dv {} >> {}.fqtest'