# This assumes the MySQL software is installed in /usr/local/mysql
inc      := /export/home/mysqldev/mlord/mysql-debug-4.0.20-sun-solaris2.8-sparc-64bit/include
lib      := /export/home/mysqldev/mlord/mysql-debug-4.0.20-sun-solaris2.8-sparc-64bit/lib
#lib      := /export/home/msolnit/iter/source/unix/out/lib

# If you have not installed the MySQL software yet, try this instead
#inc      := $(HOME)/mysql-4.0/include
#lib      := $(HOME)/mysql-4.0/libmysqld

CC       := gcc
#CPPFLAGS := -I$(inc) -D_THREAD_SAFE -D_REENTRANT -DPIC -fPIC -g -O
CPPFLAGS := -m64 -I$(inc) -D_THREAD_SAFE -D_REENTRANT
#LDFLAGS  := -shared -mimpure-text
LDFLAGS  := -m64 -mimpure-text
# You can change -lmysqld to -lmysqlclient to use the
# client/server library
#LDLIBS    = -L$(lib) -lmysqld -lpthread -lthread -lposix4 -lcrypt_i -lgen -lstdc++ -lsocket -lm -lnsl -lrt -lc
LDLIBS    = -L$(lib) -lmysqld -lpthread -lthread -lposix4 -lcrypt_i -lsocket -lm -lnsl -lrt

ifneq (,$(shell grep FreeBSD /COPYRIGHT 2>/dev/null))
# FreeBSD
#LDFLAGS += -pthread
else
# Assume Linux
LDLIBS += -lpthread -lsocket
endif

# This works for simple one-file test programs
sources := $(wildcard *.c)
objects := $(patsubst %c,%o,$(sources))
targets := $(basename $(sources))

all: $(targets)

clean:
	rm -f $(targets) $(objects) *.core

