SOCK=signed
OS=Linux
LIBS= -lcrypt
DEFNS=-DCRYPT_H
DEBUG=
OBJLINE=
CC=gcc
# @(#) Makefile.config 1.57@(#)
# pmg@alliance.centerclick.org|Makefile.config|20011019202404|05630

version = 1.2b13
objects = obj/admin.o obj/dccchat.o obj/display.o \
          obj/iroffer.o obj/misc.o obj/plugins.o \
          obj/transfer.o obj/upload.o obj/utilities.o
headers = src/defines.h src/globals.h src/headers.h Makefile
defs    = -DSIGNEDSOCK='${SOCK}' -D_OS_${OS} ${DEFNS}
flags   = ${defs} ${DEBUG} -Wall -O2
tarf    = iroffer${version}/iroffer${version}.tar
tarfos  = iroffer${version}/iroffer${version}_${OS}.tar
insdir  = /usr/local/bin

all: iroffer

iroffer: obj ${objects} ${headers}
	${CC} ${objects} ${LIBS} -o iroffer

src-doc:
	mkdir -p srcdocs
	cxref -block-comments -index-all -xref-all -Osrcdocs -Niroffer ${defs} \
	src/*.c src/*.h
	cxref -block-comments -index-all -xref-all -Osrcdocs -Niroffer ${defs} -html20 \
	src/*.c src/*.h

# I give up, there are some really fu*k'ed up versions of make out there
#   lets just define each file seperately
#${OBJLINE}
#	${CC} -c ${flags} $< -o $@

obj:
	mkdir -p obj
obj/admin.o: src/admin.c ${headers}
	${CC} -c ${flags} -o obj/admin.o src/admin.c
obj/dccchat.o: src/dccchat.c ${headers}
	${CC} -c ${flags} -o obj/dccchat.o src/dccchat.c
obj/display.o: src/display.c ${headers}
	${CC} -c ${flags} -o obj/display.o src/display.c
obj/iroffer.o: src/iroffer.c ${headers}
	${CC} -c ${flags} -o obj/iroffer.o src/iroffer.c
obj/misc.o: src/misc.c ${headers}
	${CC} -c ${flags} -o obj/misc.o src/misc.c
obj/plugins.o: src/plugins.c ${headers}
	${CC} -c ${flags} -o obj/plugins.o src/plugins.c
obj/transfer.o: src/transfer.c ${headers}
	${CC} -c ${flags} -o obj/transfer.o src/transfer.c
obj/upload.o: src/upload.c ${headers}
	${CC} -c ${flags} -o obj/upload.o src/upload.c
obj/utilities.o: src/utilities.c ${headers}
	${CC} -c ${flags} -o obj/utilities.o src/utilities.c

tar: clean
	touch * src/*
	cd ..; tar -cf ${tarf} iroffer${version}/src
	cd ..; tar -rf ${tarf} iroffer${version}/sample.config
	cd ..; tar -rf ${tarf} iroffer${version}/Makefile.config
	cd ..; tar -rf ${tarf} iroffer${version}/Configure
	cd ..; tar -rf ${tarf} iroffer${version}/README
	cd ..; tar -rf ${tarf} iroffer${version}/COPYING
	cd ..; tar -rf ${tarf} iroffer${version}/WHATSNEW
	cd ..; tar -rf ${tarf} iroffer${version}/iroffer.cron
	gzip iroffer${version}.tar
	mv iroffer${version}.tar.gz iroffer${version}.tgz

tarwin: clean
	touch * src/*
	cd ..; tar -cf ${tarf} iroffer${version}/src
	cd ..; tar -rf ${tarf} iroffer${version}/sample.config
	cd ..; tar -rf ${tarf} iroffer${version}/Makefile.config
	cd ..; tar -rf ${tarf} iroffer${version}/Configure
	cd ..; tar -rf ${tarf} iroffer${version}/README
	cd ..; tar -rf ${tarf} iroffer${version}/COPYING
	cd ..; tar -rf ${tarf} iroffer${version}/WHATSNEW
	cd ..; tar -rf ${tarf} iroffer${version}/iroffer.cron
	cd ..; tar -rf ${tarf} iroffer${version}/iroffer.exe
	cd ..; tar -rf ${tarf} iroffer${version}/cygwin1.dll
	gzip iroffer${version}.tar
	mv iroffer${version}.tar.gz iroffer_win32bin_${version}.tgz

tarbinary: clean iroffer
	touch * src/*
	mv iroffer iroffer${version}_${OS}
	ln -s iroffer${version}_${OS} iroffer
	rm obj/*.o
	cd ..; tar -cf ${tarfos} iroffer${version}/src
	cd ..; tar -rf ${tarfos} iroffer${version}/sample.config
	cd ..; tar -rf ${tarfos} iroffer${version}/Makefile.config
	cd ..; tar -rf ${tarfos} iroffer${version}/Configure
	cd ..; tar -rf ${tarfos} iroffer${version}/README
	cd ..; tar -rf ${tarfos} iroffer${version}/COPYING
	cd ..; tar -rf ${tarfos} iroffer${version}/WHATSNEW
	cd ..; tar -rf ${tarfos} iroffer${version}/iroffer.cron
	cd ..; tar -rf ${tarfos} iroffer${version}/iroffer
	cd ..; tar -rf ${tarfos} iroffer${version}/iroffer${version}_${OS}
	gzip iroffer${version}_${OS}.tar
	mv iroffer${version}_${OS}.tar.gz iroffer${version}_${OS}.tgz

clean:
	/bin/rm -f iroffer core obj/*.o src/*~ *~

install: iroffer
	install -o root -g root -m 0755 iroffer ${insdir}/iroffer

# end
