

SRC = main.c t_error.c firecat_updstat.c firecat_reqstat.c teaser_reqstat.c \
      teaser_updstat.c teaser_stpstat.c firecat_stpstat.c newacc.c \
      updacc.c reqemail.c requrl.c reqipa.c requname.c notify_contacts.c \
      get_field.c get_input_1.c handle_connection.c open_server_socket.c \
      read_record.c tfp_error.c tfp_reqstat.c tfp_updstat.c db_exec.c

OBJS = $(SRC:.c=.o)

HDRS = ../include/tfp.h ../include/teaser.h

CFLAGS = -g

ifeq ($(CONDS),suse)
override CFLAGS += -I../include -I/usr/lib/pgsql/include
else
override CFLAGS += -I../include -I/usr/include/postgresql 
endif

ifeq ($(CONDS),debian)
LINKS = -lpq -lcrypt
else
LINKS = -lpq
endif

all: $(OBJS) 
	$(CC) $(LINKS) $(OBJS) $(TFPOBJS) $(CFLAGS) -o teaser 

%.o: %.c $(HDRS)
	$(CC) $(SYSTEM) $(CFLAGS) -c $*.c

clean:
	-rm -f *.o teaser

distclean: clean
	-rm -f *~

