# change nex line to reflect your installation
APR_PREFIX=$(HOME)/apr
CC=gcc
# change next line (linux etc ...)
CFLAGS=-DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g -I$(APR_PREFIX)/include/apr-1/
LDFLAGS=-lpthread -lapr-1 -laprutil-1 -L$(APR_PREFIX)/lib/

all: test_arg test_alloc test_file test_table test_hash \
	test_thread	test_mutex test_shm test_string \
	test_env test_mmap \
	socket_client socket_server \
	test_uri test_uuid test_base64 test_md5 test_xml test_dbm

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


clean:
	rm -f *.o
	rm -f test_uri test_uuid test_base64 test_md5 test_xml test_dbm
	rm -f test_arg test_alloc test_file test_table \
		test_hash test_thread test_mutex test_shm test_string\
		test_env test_mmap \
	  socket_client socket_server
