# Makefile for mcard "Motif CardFile"
#
# ----------------- Includes  --------------------------------
# Generally, the Motif & Xlib include files are located in:
#    /usr/include/Xm   and  /usr/include/X11 respectively
#  Note, that /usr/include is typically one of the default
#  directories a compiler looks in. If you have the Xm & X11
#  directories in /usr/include, you don't need to do anything.
#
#  If Xm & X11 reside elsewhere, you will need to change the
#  "-I" option for the compiler. Make it include that directory
#  by uncommenting an example below or establishing one for your
#  system.
#  For example, "-I/home/local/include" with no space.
#
#  ########## Examples you can uncomment or change: ##########
#
# INCLUDES = -I/usr/include/X11R6/include
# INCLUDES = -I/usr/include/X11 -I/usr/openwin/include/X11
# INCLUDES = -I$(OPENWINHOME)/include -I/usr/include/X11 -I/usr/include/X11 -I/usr/include
INCLUDES = -I/usr/include/X11

# ----------------- Libraries --------------------------------
# The following libraries are needed.
# libc.a            The C lib should be known by your compiler
# libmalloc.a       May  be required if not in your C lib
# libXm.a           Motif Lib
# libXt.a           X Toolkir Intrinsics
# libX11.a          X library
# 
# The Motif & X libraries typically reside in:
#    /usr/lib
#  You may need to adjust this accordingly for your system.
#  If your libraries do not reside here, add a compiler line
#  option which will allow the linker to find them. This is
#  the "-L" option.
#
# Important note, do not change the order of the "-l" options.
# These are the references to the actual library themselves.
# The order is important here. Xm -> Xt -> X11      OK!
#
# Lastly, you may want to change the
# "-Bstatic" or "-Bdynamic" options. (-static & -dynamic for gcc)
#
# This option specifies whether the libraries are linked
# dynamically (shared-lib) or statically (non-shared).
# The default is -Bdynamic (recommended) Reduces the execution size.
#
#  ########## Examples you can uncomment or change: ##########
#
# LDLIBS = -Bstatic   -L/local/lib/motif/usr/lib -lXm -lXt -lX11 -lm
# LDLIBS = -L/local/lib/motif/usr/lib -Bdynamic -lXm -lXt -lX11 -lm
# LDLIBS =  -L/local/lib/motif/lib -lXm -lXt -lX11 -lm
# LDLIBS =  -L/usr/lib/X11R6/lib -lXm -lXt -lX11
# LDLIBS = -L$(OPENWINHOME)/lib -L/usr/lib/X11 -L/usr/local/lib -dynamic  -lXm -lXt -lX11
LDLIBS =  -L/usr/lib/X11 -lXm -lXt -lX11

# -----------------   C Flags  --------------------------------
# 
# Select these options:
# -g = debugging capabilities OR -O = optimization
#
# The default should be fine here. Generally you won't need to
# change anything.
#
# If you are using a non-ANSI compiler, like cc, use _NO_PROTO
# This tells the lexical analyzer not to do prototyping.
#
#  ########## Examples you can uncomment or change: ##########
#
# CFLAGS = -D_NO_PROTO -O9
# CFLAGS =  -D_NO_PROTO -g  ${INCLUDES}
CFLAGS =  -g  ${INCLUDES}

# -----------------   Compiler Choice  -------------------------
#
#CC= cc
CC= gcc

# -----------------   Cleaning  --------------------------------
#
# If your site uses a different command to delete, change it here
#
RM= rm -f

# ----------------- Object Files  ------------------------------
# You must have all of these files  to complete the build.
#
OBJS=      mcard.o		init.o			abend.o \
           callback.o		file_callback.o		edit_callback.o \
           view_callback.o	card_callback.o		search_callback.o \
           move_callback.o	help_callback.o		file_io.o

# -----------------  Targets  -----------------------------------
#
# The command line accepts "make" | "make all" | "make clean"
#  "make" and "make all" build mcard
#  "make clean" removes the object files. It does not remove the executable
#
all: mcard

# $? is the list of dependencies newer than the target ($OBJS)
mcard: $(OBJS)
	${CC} $(CFLAGS) -o mcard $? $(LDLIBS)

clean:
	${RM} $(OBJS)
	${RM} mcard

# -----------------  Dependencies  -------------------------------
#   The target depends on each of the Object files which in turn
#   depend on the header files. The depency below uses an
#   implicit rule to produce the object files.
#  By using "$*" (take only the base name of the current dependency)
#
#${OBJS}:  $*.c crd.h
#	${CC} $CFLAGS -c $*.c -o $*.o
# However, there's been difficulty with various systems & this rule
#
#  Reverted to redundant dependency rules like these (10MAR95):
mcard.o: mcard.c crd.h 
init.o: init.c crd.h mcard.icon
abend.o: abend.c crd.h
callback.o: callback.c crd.h 
edit_callback.o: edit_callback.c crd.h 
file_callback.o: file_callback.c crd.h 
view_callback.o: view_callback.c crd.h 
card_callback.o: card_callback.c crd.h
search_callback.o: search_callback.c crd.h 
move_callback.o: move_callback.c crd.h 
help_callback.o: help_callback.c crd.h oehler.xbm
file_io.o: file_io.c crd.h

