# Makefile for the MAGIC subsystem 

INC = `sigc-config --cflags`
LIBS = `sigc-config --libs`
#LIBS = -L/usr/local/lib/ -ltcl8.0 -lm
DEBUG = -g -DDEBUG
OPTIMIZE =
CFLAGS =$(DEBUG) $(INC) $(OPTIMIZE) -DMAXMSG=4096
CC = g++
OBJS = Subsystem.o TCPListener.o TCPSender.o PeriodicAction.o PeriodicSignal.o IONotifier.o socket_functions.o
all: mainForSubsystem mainForTCPListener mainForTCPSender mainForPeriodicAction mainForPeriodicSignal
links:
	ln -s Subsystem.plain.hxx Subsystem.hxx
	ln -s Subsystem.plain.cxx Subsystem.cxx
	ln -s TCPListener.select.hxx TCPListener.hxx
	ln -s TCPListener.select.cxx TCPListener.cxx
mainForSubsystem: mainForSubsystem.o $(OBJS)
	$(CC) -o mainForSubsystem mainForSubsystem.o $(OBJS) $(LIBS)
mainForTCPListener: mainForTCPListener.o $(OBJS)
	$(CC) -o mainForTCPListener mainForTCPListener.o $(OBJS) $(LIBS)
mainForTCPSender: mainForTCPSender.o $(OBJS)
	$(CC) -o mainForTCPSender mainForTCPSender.o $(OBJS) $(LIBS)
mainForPeriodicAction: mainForPeriodicAction.o $(OBJS)
	$(CC) -o mainForPeriodicAction mainForPeriodicAction.o $(OBJS) $(LIBS)
mainForPeriodicSignal: mainForPeriodicSignal.o $(OBJS)
	$(CC) -o mainForPeriodicSignal mainForPeriodicSignal.o $(OBJS) $(LIBS)

.SUFFIXES: .o .cxx
.cxx.o:
	$(CC) $(CFLAGS) -c $*.cxx -o $*.o
.c.o:
	$(CC) $(CFLAGS) -c $*.c -o $*.o
clean:
	rm $(OBJS) mainForSubsystem mainForTCPListener mainForTCPSender mainForPeriodicAction mainForPeriodicSignal mainForSubsystem.o mainForTCPListener.o mainForTCPSender.o mainForPeriodicAction.o mainForPeriodicSignal.o

