# ///////////////// d2m : Dublin Core to MARC converter /////////////////////
#
# The basic conversion (reading a file and producing a MARC record)
# is performed by D2Mconv.c
#
# On top of D2Mconv.c is built 2 applications:
#
# d2m   : A CGI version
#         (See documentation in main program D2Mcgi.c)
# d2main: A command line (standalone version)
#         (See documentation in main program D2Mmain.c)
#
# Both applications are capable of reading from a local file or a
# remote file using builtin HTTP client services. 
#
# (You can compile a version of d2main without HTTP ability by
#   make d2main-nosock 
# )
#
# Both applications has the added ability to read a 2709 MARC record
# instead of DC metadata, using M2Mconv.c to perform the conversion.
# (This is not a MARC converter with the ability to convert between
# MARC formats, just between "presentation syntaxes".
#
# 1998-10-15 Ole Husby
#

CC = cc 

# This may have to uncomment this on solaris:
# LIBS = -lsocket -lnsl

OBJ = D2Mconv.o M2Mconv.o marc2line.o util.o MARC2709.o MARCmake.o MARCtidy.o dc_parse.o
OBJ_MARC = danMARC.o finMARC.o isMARC.o norMARC.o sweMARC.o usMARC.o
OBJ_SOCK = wfetch.o htget.o
OBJ_NOSOCK = wfetch-l.o

all: d2m d2main

d2m: D2Mcgi.o $(OBJ) $(OBJ_MARC) $(OBJ_SOCK) 
	@echo "------------------- Compiling d2m -------------------------------" 
	$(CC) D2Mcgi.o $(OBJ) $(OBJ_MARC) $(OBJ_SOCK) -o d2m $(LIBS) 

d2main: D2Mmain.o $(OBJ) $(OBJ_MARC) $(OBJ_SOCK) 
	@echo "------------------- Compiling d2main ----------------------------" 
	$(CC) D2Mmain.o $(OBJ) $(OBJ_MARC) $(OBJ_SOCK) -o d2main $(LIBS) 

d2main-nosock: D2Mmain.o $(OBJ) $(OBJ_MARC) $(OBJ_NOSOCK) 
	@echo "------------------- Compiling d2main (no sockets) ---------------" 
	$(CC) D2Mmain.o $(OBJ) $(OBJ_MARC) $(OBJ_NOSOCK) -o d2main $(LIBS) 


D2Mcgi.o: D2Mcgi.c d2m.h
	$(CC) -c D2Mcgi.c

D2Mmain.o: D2Mmain.c d2m.h
	$(CC) -c D2Mmain.c

D2Mconv.o: D2Mconv.c d2m.h
	$(CC) -c D2Mconv.c

M2Mconv.o: M2Mconv.c
	$(CC) -c M2Mconv.c

marc2line.o: marc2line.c 
	$(CC) -c marc2line.c

MARCmake.o: MARCmake.c d2m.h
	$(CC) -c MARCmake.c

MARCtidy.o: MARCtidy.c d2m.h
	$(CC) -c MARCtidy.c

MARC2709.o: MARC2709.c d2m.h
	$(CC) -c MARC2709.c

dc_parse.o: dc_parse.c d2m.h
	$(CC) -c dc_parse.c

util.o: util.c d2m.h
	$(CC) -c util.c 

danMARC.o: danMARC.c d2m.h
	$(CC) -c danMARC.c

finMARC.o: finMARC.c d2m.h
	$(CC) -c finMARC.c

isMARC.o: isMARC.c d2m.h
	$(CC) -c isMARC.c

norMARC.o: norMARC.c d2m.h
	$(CC) -c norMARC.c

sweMARC.o: sweMARC.c d2m.h
	$(CC) -c sweMARC.c

usMARC.o: usMARC.c d2m.h
	$(CC) -c usMARC.c

wfetch.o: wfetch.c
	$(CC) -c wfetch.c

wfetch-l.o: wfetch-l.c
	$(CC) -c wfetch-l.c

htget.o: htget.c 
	$(CC) -c htget.c 

clean:
	rm -f *.o d2m d2main
