#==============================================================================
# Project:	INFSCI 2710 "Database Manamement"
# Version:	Spring 1999
# Module:	makefile
# Purpose:	Example Makefile for Embedded SQL C-Program
# Last Change:	03.04.1999
# Language:	make
# Authors:	Stefan Brass
# Email:	sbrass@sis.pitt.edu
# Address:	Univ. of Pittsburgh, School of Information Sc., PA 15260, USA
# Copyright:	(c) 1999 by Stefan Brass
# Copying:	You may do anything with this, but don't make me responsible.
#==============================================================================

#==============================================================================
# Files:
#==============================================================================

PROGRAM	= demo

goal: $(PROGRAM)

OBJECTS	= demo.o

SOURCES	= # C-files (except the one created from a *.pc file)

PC_SRC = demo.pc
C_SRC = demo.c

HEADERS	= # .h-files

#==============================================================================
# Oracle Pro*C Definitions:
#==============================================================================

include $(ORACLE_HOME)/precomp/lib/env_precomp.mk

#==============================================================================
# Precompile Pro*C File:
#==============================================================================

$(C_SRC): $(PC_SRC)
	$(PROC) $(PROCFLAGS) iname=$*.pc 

#==============================================================================
# Generate Program:
#==============================================================================

$(PROGRAM): $(OBJECTS)
	@echo
	@echo 'Linking ...'
	@$(CC) -o $(PROGRAM) $(OBJECTS) -L$(LIBHOME) -R$(LIBHOME) $(PROLDLIBS)
	@echo 'done.'

#==============================================================================
# Which compiler:
#==============================================================================

CC	= gcc
CFLAGS	= -g -O -Wall -Wshadow  -Wpointer-arith -Wcast-qual -Wwrite-strings \
	-pedantic -Wid-clash-11
#CCLIB	= /usr/local/lib/gcc-lib/sparc-sun-solaris2.4/2.6.3/libgcc.a
CCLIB	=

LD	= $(CC)

#==============================================================================
# Which lint:
#==============================================================================

LINT	= /opt/SUNWspro/bin/lint
#LINT	= /usr/bin/lint
LIFLAGS	= -abchx -DCC_LINT -DOS_SUNOS

#==============================================================================
# Which make depend:
#==============================================================================

#MAKEDEP = makedep "cc -M $(CFLAGS)"
MAKEDEP = makedep "gcc -M $(CFLAGS)"

#==============================================================================
# Other commands:
#==============================================================================

PR	= a2ps
LPR	= lpr -Plw-t

#==============================================================================
# Lint:
#==============================================================================

lint: lintout
	more lintout

lintout: $(SOURCES) $(C_SRC) $(HEADERS)
	$(LINT) $(LIFLAGS) $(SOURCES) $(C_SRC) >lintout

#==============================================================================
# Miscellaneous commands:
#==============================================================================

clean:
	rm -f $(OBJECTS)
	rm -f $(PROGRAM)
	rm -f lintout
	rm -f tags index
	rm -f makefile.bak
	rm -f makedep.tmp
	rm -f core

print:
	$(PR) makefile $(HEADERS) $(SOURCES) $(PC_SRC) | $(LPR)

tags: $(SOURCES) $(C_SRC) $(HEADERS)
	ctags -t tags $(SOURCES) $(C_SRC) $(HEADERS)

index: $(SOURCES) $(C_SRC) $(HEADERS)
	ctags -x $(SOURCES) $(C_SRC) $(HEADERS) |sort -f >index

tsort:
	lorder $(OBJECTS) | tsort

depend:
	$(MAKEDEP) makefile $(SOURCES) $(C_SRC)

#==============================================================================
# Dependencies:
#==============================================================================

# Begin of dependencies. DO NOT DELETE THIS LINE -- make depend depends on it.
demo.o: demo.c
# End of dependencies. DO NOT DELETE THIS LINE -- make depend depends on it.

