# -*- Mode: Makefile -*-
#
# $Header: /home/gene/library/website/docsrc/cloop/RCS/Makefile,v 395.1 2008/04/20 17:25:50 gene Exp $
#
# Copyright (c) 1999, 2006 Gene Michael Stover.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
# USA
#

CFLAGS=-Wall
CC=gcc
COMPILE_c=$(CC) $(CFLAGS) -c
LINK_c=$(CC) $(CFLAGS)

CXXFLAGS=-Wall
CXX=gcc
COMPILE_cxx=$(CXX) $(CXXFLAGS) -c
LINK_cxx=$(CXX) $(CXXFLAGS)

LIBS=lib/libcloop.a

all :	\
	bin/print-seconds \
	bin/test0000 \
	bin/test0001 \
	bin/test0002 \
	lib/libcloop.a

check : all
	bin/test0000
	bin/test0001
	bin/test0002

HEADERS=src/cloop.h src/teq.h src/this.h src/timeevent.h src/types.h \
	src/xmalloc.h

bin/print-seconds : src/print-seconds.c $(HEADERS) lib/libcloop.a
	$(LINK_c) -obin/print-seconds src/print-seconds.c $(LIBS)

bin/test0000 : src/test0000.c
	$(LINK_c) -obin/test0000 src/test0000.c

bin/test0001 : src/test0001.c lib/libcloop.a
	$(LINK_c) -obin/test0001 src/test0001.c

bin/test0002 : src/test0002.c lib/libcloop.a
	$(LINK_c) -obin/test0002 src/test0002.c $(LIBS)

OBJS=tmp/cloop-unix.o tmp/teq.o tmp/xmalloc.o

lib/libcloop.a : $(OBJS)
	ar rcu lib/libcloop.a $(OBJS)
	ranlib lib/libcloop.a

tmp/cloop-unix.o : src/cloop-unix.c $(HEADERS)
	$(COMPILE_cxx) -o tmp/cloop-unix.o src/cloop-unix.c

tmp/teq.o : src/teq.c $(HEADERS)
	$(COMPILE_c) -otmp/teq.o src/teq.c

tmp/xmalloc.o : src/xmalloc.c $(HEADERS)
	$(COMPILE_c) -otmp/xmalloc.o src/xmalloc.c

# --- end of file ---
