CXX=g++ CXXFLAGS=-O0 -g -fPIC -fno-common LDFLAGS= LD=g++ INIT=-dynamic INITCXX=-Wl,-dylib -dylib -dynamic -nostdlib -g -ldylib1.o #INIT=-init initdso -E --no-whole-archive #INITCXX=-Wl,-init,initdso SYSLIBS=-lstdc++ -lgcc -lSystem AR = ar vru all: main-s main-d .SUFFIXES: .cc .o .cc.o: $(CXX) $(CXXFLAGS) -c $< main-s: main.o libmydso.a $(LD) $(LDFLAGS) -o $@ main.o libmydso.a main-d: libmydso.dylib main.o $(LD) $(LDFLAGS) -o $@ main.o -L. -lmydso libmydso.dylib: dso.o $(LD) $(INITCXX) -g $(LDFLAGS) -o $@ dso.o $(SYSLIBS) libmydso.a: dso.o $(AR) $@ dso.o ranlib libmydso.a libmydso2.dylib: dso.o libtool $(INIT) -o $@ dso.o $(SYSLIBS) main-dd: libmydso2.dylib main.o $(LD) $(LDFLAGS) -o $@ main.o -L. -lmydso2 test: main-d main-s main-dd env LD_LIBRARY_PATH=. ./main-d ./main-s env LD_LIBRARY_PATH=. ./main-dd clean: rm -f *.o *.dylib *.a main-d main-dd main-s