CC=gcc
MKEXP=mkexp.sh
LDFLAGS=-bM:SRE -T512 -H512 -lc -bnoentry
# 
#-bM:SRE  oder -G (>=AIX4.2)
# vermulich:  erok, rtl, nortllib, nosymbolic,noautoexp
#-H<X>    offset align fuer text,data,loader
#-T<X>    offset fuer text section
#-lc	   link libc (no unresolved symbols)
#-b noentry  no entry label
#
# M       Modul
# RE      Reusable. Module requires a private copy of the data area for each
# process dependent on the module.
# If an S prefix is used the shared flag in the object file is set
#
#


ARFLAGS=r
AR=ar
SRC=subself.c subext.c
OBJ=subself.o subext.o
LO=subself.lo subext.lo 



submain:  libshr.so
	$(CC) -c submain.c
	$(CC) -o submain submain.o  ./libshr.so


libshr.so: $(LO)
	$(AR) $(ARFLAGS) $@ $(LO)


%.lo : %.o
	$(MKEXP) $< >$*.exp
	$(LD) $(LDFLAGS) -bE:$*.exp -o $*.lo $*.o



$(OBJ) : $(SRC)


clean:
	@rm $(OBJ)
	@rm $(LO)
	@rm libshr.so
