14bd2bfb6SVedant KumarCXX_SOURCES := main.cpp 24bd2bfb6SVedant KumarUSE_LIBDL := 1 34bd2bfb6SVedant Kumar 44bd2bfb6SVedant Kumarall: t2_0 t2_1 t1 a.out 54bd2bfb6SVedant Kumar 64bd2bfb6SVedant Kumarinclude Makefile.rules 74bd2bfb6SVedant Kumar 8*5e004b03SVedant Kumarifeq "$(OS)" "Darwin" 9*5e004b03SVedant Kumar # In macOS 12, dyld switched to using chained fixups. As a result, all 10*5e004b03SVedant Kumar # symbols are bound at launch and there are no lazy pointers any more. 11*5e004b03SVedant Kumar # Since we wish to import/dlopen() a dylib with missing symbols, we need 12*5e004b03SVedant Kumar # to use a weak import. This applies to all macOS 12-aligned OS releases, 13*5e004b03SVedant Kumar # e.g. iOS 15, etc. 14*5e004b03SVedant Kumar LINKFLAGS := "-Wl,-weak-lt2_0" 15*5e004b03SVedant Kumarelse 16*5e004b03SVedant Kumar LINKFLAGS := "-lt2_0" 17*5e004b03SVedant Kumarendif 18*5e004b03SVedant Kumar 194bd2bfb6SVedant Kumart1: t2_0 204bd2bfb6SVedant Kumar $(MAKE) VPATH=$(SRCDIR) -f $(MAKEFILE_RULES) \ 21*5e004b03SVedant Kumar DYLIB_ONLY=YES DYLIB_C_SOURCES=t1.c DYLIB_NAME=t1 LD_EXTRAS="-L. $(LINKFLAGS)" 224bd2bfb6SVedant Kumar 234bd2bfb6SVedant Kumart2_0: 244bd2bfb6SVedant Kumar $(MAKE) VPATH=$(SRCDIR) -f $(MAKEFILE_RULES) \ 254bd2bfb6SVedant Kumar DYLIB_ONLY=YES DYLIB_C_SOURCES=t2_0.c DYLIB_NAME=t2_0 264bd2bfb6SVedant Kumar 274bd2bfb6SVedant Kumart2_1: 284bd2bfb6SVedant Kumar $(MAKE) VPATH=$(SRCDIR) -f $(MAKEFILE_RULES) \ 294bd2bfb6SVedant Kumar DYLIB_ONLY=YES DYLIB_C_SOURCES=t2_1.c DYLIB_NAME=t2_1 30