
# Include debugging symbols (-g) or optimize code (-O or -O2).

DEBUG=-g

# CS248 software directory.

BASEDIR=/usr/class/cs248/support

ifeq ($(HOSTTYPE), i386-linux)
	# Motif library for Linux is in /usr/pubsw/X/lib and 
	# not in /usr/lib as is for the Solaris and Irix machines
  # We also tell the linker where it can find the Motif shared library at
  # run time so we don't need to set LD_LIBRARY_PATH

# added a new linker path to /usr/pubsw/lib for the libstdc++.* shared objects
#	CS248_LIBS=-L/usr/pubsw/X/lib -Xlinker -rpath -Xlinker /usr/pubsw/X/lib
#CS248_LIBS=-L/usr/pubsw/X/lib #-Xlinker -rpath -Xlinker /usr/pubsw/X/lib -Xlinker -rpath -Xlinker /usr/pubsw/lib
CS248_LIBS=-L/usr/X11R6/lib -Xlinker -rpath -Xlinker /usr/class/cs248/support/lib/i386-linux

X_LIBS = -lXm -lXp -lXext -lXt -lX11 -lm

endif
ifeq ($(HOSTTYPE), sun4)
X_LIBS = -lXm -lXt -lX11 -lm
endif

# The object files comprising the application code.
# Use spaces to separate multiple files.

OBJS=paint.o

# The name of the executable.

TARGET=paint.$(HOSTTYPE)

# Compiler Setup

CC=gcc
CXX=g++

# LINKING.

$(TARGET): $(OBJS) Makefile
	$(CXX) -Wall $(DEBUG) -o $@ $(OBJS) -L$(BASEDIR)/lib/$(HOSTTYPE) \
	$(CS248_LIBS) -lxsupport $(X_LIBS) 

# -lX11 -L/lib -L/usr/lib


# COMPILATION.

.c.o:
	$(CXX) -Wall $(CS348B_INCLUDE) -I$(BASEDIR)/include/ $(DEBUG) -c -o $@ $*.c


# CLEANUP.

clean:
	rm -f $(OBJS) $(TARGET)
