## makes a shared object: choose the target operating system

OBJECT=usertemplate
EXTRAHDRS=-DXMSTRINGDEFINES=1 -DXTSTRINGDEFINES=1 -DNO_DEFS_REQUIRED
EXTRALIBS=
STDINCLUDES=-I. ${EXTRAHDRS}
STDDEFS=-DXDSOBJECTCREATOR=new${OBJECT} -c

HPINCLUDES=-I/usr/include/Motif1.2 -I/usr/include/X11R5
HPLIBS= -ldld -L/usr/lib/Motif1.2 -lXm -L/usr/lib/X11R5 -lXt
HPCFLAGS=-Aa -D_HPUX_SOURCE -DHP -Wp,-H900000 +DA1.0 +DS1.0

all:
	@echo "Supported Systems Are:"
	@echo ""
	@echo "solaris"
	@echo "sunos4"
	@echo "hpux"
	@echo "sgi"

clean:
	-rm -f *.o *.so

sunos4:
	-rm -f *.o
	cc ${STDINCLUDES}  -I${XDROOT}/lib -I${XDROOT}/lib/X11 ${STDDEFS} -DSUN -DSUN_OS4 -PIC *.c
	/usr/bin/ld -assert nodefinitions -dc -dp *.o ${EXTRALIBS}
	mv a.out lib${OBJECT}-r6.so
	-rm -f *.o
	cc ${STDINCLUDES}  ${STDDEFS} -DSUN -DSUN_OS4 -PIC *.c
	/usr/bin/ld -assert nodefinitions -dc -dp *.o ${EXTRALIBS}
	mv a.out lib${OBJECT}-r5.so
	-rm -f *.o


solaris:
	-rm -f *.o
	cc ${STDINCLUDES}  -I/usr/dt/include -I/usr/openwin/include ${STDDEFS} -DSOLARIS -Xt -K PIC *.c
	ld -G *.o ${EXTRALIBS}
	mv a.out lib${OBJECT}.so
	-rm -f *.o

hpux:
	-rm -f *.o
	cc ${STDINCLUDES}  ${HPINCLUDES} ${STDDEFS} ${HPCFLAGS} +Z *.c
	ld -b *.o -B immediate ${HPLIBS} ${EXTRALIBS}
	mv a.out lib${OBJECT}.sl
	-rm -f *.o

sgi:
	-rm -f *.o
	cc -cckr -D_XmConst= ${STDINCLUDES}  ${STDDEFS} -KPIC *.c
	ld -shared -soname lib${OBJECT}.so *.o ${EXTRALIBS}
	mv a.out lib${OBJECT}.so
	-rm -f *.o


osf:
	-rm -f *.o
	cc ${STDINCLUDES}  ${STDDEFS} *.c
	ld -shared -soname lib${OBJECT}.so *.o ${EXTRALIBS}
	mv a.out lib${OBJECT}.so
	-rm -f *.o
