# --------------------------------------------------------------------
#
# Sample Makefile for building mincexample
#

# Executable names
PROGS    = mincexample1 mincexample2
EXTRA_OBJ = time_stamp.o
CDEFINES = -DDEBUG#                        cpp defines
OPT      = -O
INCLUDES = -I. -I/usr/local/include
LDOPT    = -lminc -lnetcdf -lsun -lc_s

# --------------------------------------------------------------------

CFLAGS    = $(CDEFINES) $(INCLUDES) $(OPT)# CFLAGS and LINTFLAGS should
LINTFLAGS = $(CDEFINES) $(INCLUDES)#        be same, except for -g/-O

PROG_OBJ  = $(PROGS:=.o)#                 list of objects

# --------------------------------------------------------------------

default: $(PROGS)

#Dependency on Makefile
$(PROG_OBJ) $(EXTRA_OBJ) : Makefile

.c.o:#                                    defines the rule for creating .o
	$(CC) $(CFLAGS) -c $< -o $@

# How to make executables
$(PROGS) : $$@.o $(EXTRA_OBJ)
	$(CC) $@.o $(EXTRA_OBJ) -o $@ $(LDOPT)

# Remove all derived files in this directory
clean:
	rm -f $(PROGS) $(PROG_OBJ) $(EXTRA_OBJ)

