# file: doc/examples/billing/C/Makefile

# IMPORTED VARIABLES
LIBDIR=/usr/local/scorpion/lib
BINDIR=/usr/local/scorpion/bin
CC=cc
IDLC=$(BINDIR)/idlc
PC=pc
CFLAGS=-I$(INCDIR)/C
IDLCFLAGS=
PFLAGS=
CP=cp
MV=mv
RM=rm -f
LEX=lex
MAKE=make
YACC=yacc
UTILITYVARS='CC=$(CC)' 'IDLC=$(IDLC)' 'PC=$(PC)' 'CFLAGS=$(CFLAGS)' \
	      'IDLCFLAGS=$(IDLCFLAGS)' 'PFLAGS=$(PFLAGS)' 'CP=$(CP)' \
	      'MV=$(MV)' 'RM=$(RM)' 'LEX=$(LEX)' 'MAKE=$(MAKE)' \
	      'YACC=$(YACC)'
CI=ci
CO=co -l

# LOCAL VARIABLES
SRC=algorithm.c
OBJ=billing.o algorithm.o
LIB=$(LIBDIR)/libidl.a
IDLCHECK=$(BINDIR)/idlcheck
IDLCFLAGSLOC=-I.. -C billing.Cdl  #force labels on output
HASIDLVIEW=true

##############################################################

example: billing billing.Cdl
#reads customers.in, transactions.in, creates customers.out, bills.out
	$(RM) customers.in transactions.in customers.out bills.out
	ln -s ../test/customers.in customers.in
	ln -s ../test/transactions.in transactions.in
	billing
	$(IDLCHECK) -v -C billing.Cdl  \
            customers_in customers.in \
            customers_out customers.out \
            bills_out bills.out \
            transactions_in transactions.in 2> idlcheck.out

billing : $(OBJ) $(LIB)
	-if ($(HASIDLVIEW)) then \
		$(CC) $(CFLAGS) -u _IDLVlib $(OBJ) $(LIB) -o billing; \
	else \
		$(CC) $(CFLAGS) $(OBJ) $(LIB) -o billing; \
	fi

billing.h billing.o billing.Cdl: ../billingproc.idl billing.idl
	$(IDLC) $(IDLCFLAGS) $(IDLCFLAGSLOC) billing.idl

algorithm.o : algorithm.c billing.h
	$(CC) $(CFLAGS) -c algorithm.c

Clean:
	$(RM) billing *.Cdl *.o billing.h billingMacros.h \
		customers.out bills.out *.list
