#!/bin/sh

# mkmf_solaris - create a simplified Solaris makefile.  This is executed by the
# top-level Makefile, when specifying a target of "solaris".
# Environment variables are set up by Makefile.
# The generated makefile is for the distribution only.
# Note: this is very similar to makefile.linux, including assumption of GNU tools.


# set some default locations etc.

cat <<ENDOFIT
# Solaris Makefile (GNU tools) for DeviceMate Target Communications Library
CC = gcc
LDFLAGS += -lm 
INCDIRS += 
DEFINES +=
CPPFLAGS += -g \$(INCDIRS)

other_objs = tc.o tc_sysv.o
other_hdrs = tc.h
tc_objs = ${tc_objs}
tc_hdrs = ${tc_hdrs}

all:	${DEMOS}

ENDOFIT

# Loop over all target executables, emitting makefile constructs

for i in ${DEMOS}; do
extralibs=
if [ "$i" == "var" ]; then
	extralibs="-lm"
elif [ "$i" == "tcp_time" ]; then
	extralibs="-lm"
fi

cat <<ENDOFIT

${i}:	\$(tc_objs) ${i}.o \$(other_objs)
	\$(CC) -o ${i} \$(LDFLAGS) ${i}.o \$(other_objs) ${!i} ${extralibs}

${i}.o:	${i}.c \$(tc_hdrs) \$(other_hdrs)

ENDOFIT

done


# Loop over all library objects, emitting makefile constructs

for i in ${TC_LIBEXE}; do

cat <<ENDOFIT
${i}.o:	${i}.c \$(tc_hdrs)

ENDOFIT

done


# Create a few ad-hoc targets
cat <<ENDOFIT

tc.o:		tc.c tc.h ${CONFIG} tc_defs.h
tc_sysv.o:	tc_sysv.c ${CONFIG} tc_defs.h \$(other_hdrs)

clean:
	rm -f *.o ${DEMOS}
ENDOFIT
echo ""

