#
# Linux makefile for assignment #1
#



#
# List of source files
#

EXESRCS=imgpro.cpp R2Image.cpp R2Pixel.cpp
LIBSRCS=R2Distance.cpp R2Segment.cpp R2Line.cpp R2Point.cpp R2Vector.cpp



#
# Compile and link options
#

CC=g++
CPPFLAGS=-Wall -I. -g 
LDFLAGS=-g



#
# JPEG stuff
#

JPEGFLAGS=-DUSE_JPEG
JPEGLIB=jpeg/libjpeg.a


#
# Object and executable file names
#

LIBOBJS=$(LIBSRCS:.cpp=.o)
EXEOBJS=$(EXESRCS:.cpp=.o)
LIB=libR2.a
EXE=imgpro


%.o: %.cpp
	    $(CC) $(CPPFLAGS) $(JPEGFLAGS) -c $< -o $@



#
# Make targets
#

$(EXE): $(LIB) $(EXEOBJS) 
	    $(CC) -o $(EXE) $(CPPFLAGS) $(LDFLAGS) $(EXEOBJS) $(LIB) $(JPEGLIB) -lm

$(LIB): $(LIBOBJS)
	    - rm -f $(LIB)
	    ar ur $(LIB) $(LIBOBJS)

clean:
	    -  rm -f *~ *.o *.obj *.pdb $(EXE) $(LIB)

