30 lines · plain
1CXX_SOURCES := main.cpp2USE_LIBDL := 13 4all: t2_0 t2_1 t1 a.out5 6include Makefile.rules7 8ifeq "$(OS)" "Darwin"9 # In macOS 12, dyld switched to using chained fixups. As a result, all10 # symbols are bound at launch and there are no lazy pointers any more.11 # Since we wish to import/dlopen() a dylib with missing symbols, we need12 # to use a weak import. This applies to all macOS 12-aligned OS releases,13 # e.g. iOS 15, etc.14 LINKFLAGS := "-Wl,-weak-lt2_0"15else16 LINKFLAGS := "-lt2_0"17endif18 19t1: t2_020 "$(MAKE)" VPATH=$(SRCDIR) -f $(MAKEFILE_RULES) \21 DYLIB_ONLY=YES DYLIB_C_SOURCES=t1.c DYLIB_NAME=t1 LD_EXTRAS="-L. $(LINKFLAGS)"22 23t2_0:24 "$(MAKE)" VPATH=$(SRCDIR) -f $(MAKEFILE_RULES) \25 DYLIB_ONLY=YES DYLIB_C_SOURCES=t2_0.c DYLIB_NAME=t2_026 27t2_1:28 "$(MAKE)" VPATH=$(SRCDIR) -f $(MAKEFILE_RULES) \29 DYLIB_ONLY=YES DYLIB_C_SOURCES=t2_1.c DYLIB_NAME=t2_130