# the directory where the modules and the sconfig file will live
LIBDIR = $(PWD)

# the directory where the binaries will live
BINDIR = $(PWD)


SRCS = CloseFileHook.cc \
	ExecHook.cc FDClass.cc fetchstr.cc Hook.cc LWPHook.cc main.cc \
	PageFaultHook.cc RWFileHook.cc \
	OpenFileHook.cc sysentry.cc

OBJS := $(SRCS:.cc=.o)
BIN = janus

#CC = gcc
#C++ = gcc
#CFLAGS = -g -Wall -DLIBDIR=\"$(LIBDIR)\" -DBINDIR=\"$(BINDIR)\"
#MDD ut austin's gcc doesn't seem to work with dynamic linkage (e.g. dlopen)
CC=/opt/SUNWspro/bin/CC
CPP=/opt/SUNWspro/bin/CC
#CFLAGS = -g -DLIBDIR=\"$(LIBDIR)\" -DBINDIR=\"$(BINDIR)\"
CFLAGS = -g



all: $(BIN)

install: all
	install -d -m 755 $(LIBDIR)
	install -d -m 755 $(BINDIR)
	for i in sconfig $(MODULES); do \
	  install -m 644 $$i $(LIBDIR); done
	for i in $(BIN); do \
	  install -m 755 $$i $(BINDIR); done

janus: $(OBJS)
	$(CPP) $(CFLAGS) -o janus $(OBJS) -ldl -lnsl -lsocket

.c.o:
	$(CC) $(CFLAGS) -o $@ -c $<


.cc.o:
	$(CPP) $(CFLAGS) $< -o $@ -c 

depend:
	makedepend $(SRCS) -f mk.depend

clean:
	-rm -f *.o

veryclean: clean
	-rm -f $(BIN) $(MODULES)

include mk.depend

# DO NOT DELETE THIS LINE -- make depend depends on it.
