#
#  REFERENCES -- bibliographic software
#  Copyright (C) 1995-2007  Volker Kiefel
#
#  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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
#  USA
#
# ------------------------------------------------------------------------
#
# References bibliographic software v4.3
#

# This makefile expects that a `bin'-subdirectory exists for the executable
# files to be generated

### -- Please select your compiling environment: uncomment the items below
###    according to the appropriate computing environment

### -- BEGIN: select between Linux and win32

## Linux with GCC, utf-8 encoded text
CFLAGS=-c -Wall -DREFS_USES_LINUXGCC
REFSEXE := refs43
ETEXTEXE := etext
RADMINEXE := radmin
CP850_TO_LATIN1EXE := cp850-to-latin1

## Win32 with MinGW compiler
# CFLAGS=-c -Wall -DREFS_USES_MINGW
# REFSEXE := refs43.exe
# ETEXTEXE := etext.exe
# RADMINEXE := radmin.exe
# CP850_TO_LATIN1EXE := cp850-to-latin1.exe

### -- END: select between Linux and win32


## More compiler options
#CFLAGS=-c -Wall -Wredundant-decls
#CFLAGS=-c -Wall -DNDEBUG

##To compile a Linux 32 bit-Version add -m32 to LFLAGS and CFLAGS
#LFLAGS=-m32


CC=gcc $(CFLAGS)
# CC=g++ $(CFLAGS)

ODATS=*.o

CLINKER=gcc $(LFLAGS) 
# CLINKER=g++ $(LFLAGS) 

refs43/bin/$(REFSEXE) : refs43.o str_fun.o interf.o initial.o fl_ut.o \
	mmenu.o ix01_fun.o sortix01.o ix02_fun.o sortix02.o \
	ix03_fun.o sortix03.o ix04_fun.o sortix04.o sortfd.o \
	sortbbf1.o sortbbf2.o re_brow.o rfnr_fun.o transf.o \
	bbf_fun.o expo_fun.o re_edit.o ks_edit.o search.o list_fun.o \
	list_bib.o btch_fun.o file_mg.o rfd_fun1.o list_rfd.o \
	str_refs.o stru_fun.o medl_ir.o drec_fun.o f_ver.o list_kj.o \
	list_abs.o refs2tex.o srtf.o xtrrm.o recode.o
	$(CLINKER) refs43.o str_fun.o interf.o initial.o fl_ut.o \
	mmenu.o ix01_fun.o sortix01.o ix02_fun.o sortix02.o \
	ix03_fun.o sortix03.o ix04_fun.o sortix04.o sortfd.o \
	sortbbf1.o sortbbf2.o re_brow.o rfnr_fun.o transf.o \
	bbf_fun.o expo_fun.o re_edit.o ks_edit.o search.o list_fun.o \
	list_bib.o btch_fun.o file_mg.o rfd_fun1.o list_rfd.o \
	str_refs.o stru_fun.o medl_ir.o drec_fun.o f_ver.o list_kj.o \
	list_abs.o refs2tex.o srtf.o xtrrm.o recode.o \
	-o refs43/bin/$(REFSEXE)


refs43.o: refs43.c refs.h interf.h rglobal.h fd.h fl_ut.h initial.h \
	mmenu.h str_fun.h transf.h
	$(CC) refs43.c

str_fun.o: str_fun.c str_fun.h refs.h
	$(CC) str_fun.c

interf.o: interf.c refs.h str_fun.h interf.h fl_ut.h recode.h
	$(CC) interf.c

initial.o: initial.c initial.h str_fun.h refs.h interf.h fl_ut.h
	$(CC) initial.c

fl_ut.o: fl_ut.c refs.h fl_ut.h str_fun.h interf.h initial.h
	$(CC) fl_ut.c


mmenu.o: mmenu.c refs.h interf.h fl_ut.h mmenu.h re_brow.h str_fun.h \
	transf.h expo_fun.h rfnr_fun.h re_edit.h ks_edit.h search.h \
	list_fun.h list_bib.h list_rfd.h btch_fun.h file_mg.h rfd_fun1.h fd.h \
	stru_fun.h initial.h medl_ir.h drec_fun.h f_ver.h list_kj.h \
	list_abs.h refs2tex.h srtf.h xtrrm.h
	$(CC) mmenu.c

ix01_fun.o: ix01_fun.c refs.h ix01_fun.h fl_ut.h interf.h
	$(CC) ix01_fun.c

sortix01.o: sortix01.c refs.h str_fun.h fl_ut.h interf.h
	$(CC) sortix01.c

ix02_fun.o: ix02_fun.c refs.h ix02_fun.h str_fun.h fl_ut.h interf.h
	$(CC) ix02_fun.c

sortix02.o: sortix02.c refs.h str_fun.h fl_ut.h interf.h
	$(CC) sortix02.c

ix03_fun.o: ix03_fun.c refs.h ix03_fun.h str_fun.h fl_ut.h interf.h
	$(CC) ix03_fun.c

sortix03.o: sortix03.c refs.h str_fun.h fl_ut.h interf.h
	$(CC) sortix03.c

ix04_fun.o: ix04_fun.c refs.h ix04_fun.h str_fun.h fl_ut.h interf.h
	$(CC) ix04_fun.c

sortix04.o: sortix04.c refs.h str_fun.h fl_ut.h interf.h
	$(CC) sortix04.c

sortfd.o: sortfd.c fd.h str_fun.h fl_ut.h refs.h interf.h
	$(CC) sortfd.c

sortbbf1.o: sortbbf1.c refs.h str_fun.h fl_ut.h interf.h
	$(CC) sortbbf1.c

sortbbf2.o: sortbbf2.c refs.h str_fun.h fl_ut.h interf.h
	$(CC) sortbbf2.c

re_brow.o: re_brow.c refs.h re_brow.h ix01_fun.h ix02_fun.h ix04_fun.h \
	fl_ut.h str_fun.h initial.h interf.h
	$(CC) re_brow.c

rfnr_fun.o: rfnr_fun.c rfnr_fun.h str_fun.h refs.h
	$(CC) rfnr_fun.c

transf.o: transf.c transf.h refs.h str_fun.h fl_ut.h ix01_fun.h \
	sortix01.h sortix02.h ix02_fun.h sortix03.h ix03_fun.h sortix04.h \
	ix04_fun.h interf.h initial.h
	$(CC) transf.c

bbf_fun.o: bbf_fun.c refs.h str_fun.h fl_ut.h interf.h bbf_fun.h
	$(CC) bbf_fun.c

expo_fun.o: expo_fun.c refs.h expo_fun.h ix01_fun.h ix02_fun.h \
	ix03_fun.h ix04_fun.h fl_ut.h str_fun.h bbf_fun.h sortbbf1.h \
	initial.h interf.h
	$(CC) expo_fun.c

re_edit.o: re_edit.c refs.h expo_fun.h ix01_fun.h ix02_fun.h \
	ix03_fun.h ix04_fun.h fl_ut.h str_fun.h initial.h interf.h re_edit.h \
	transf.h
	$(CC) re_edit.c

ks_edit.o: ks_edit.c ks_edit.h refs.h fl_ut.h str_fun.h initial.h interf.h \
	ix02_fun.h ix03_fun.h sortix02.h sortix03.h
	$(CC) ks_edit.c

search.o: search.c search.h refs.h str_fun.h interf.h rglobal.h fd.h \
	fl_ut.h ix01_fun.h sortbbf1.h bbf_fun.h initial.h
	$(CC) search.c


list_fun.o: list_fun.c refs.h list_fun.h ix01_fun.h ix02_fun.h fl_ut.h \
	str_fun.h interf.h initial.h
	$(CC) list_fun.c

list_bib.o: list_bib.c refs.h list_bib.h ix01_fun.h ix02_fun.h fl_ut.h \
	str_fun.h interf.h initial.h
	$(CC) list_bib.c

btch_fun.o: btch_fun.c refs.h str_fun.h fl_ut.h ix01_fun.h sortbbf1.h \
	sortbbf2.h rglobal.h fd.h interf.h bbf_fun.h initial.h
	$(CC) btch_fun.c

file_mg.o: file_mg.c refs.h str_fun.h fl_ut.h interf.h initial.h
	$(CC) file_mg.c

rfd_fun1.o: rfd_fun1.c fd.h refs.h rfd_fun1.h fl_ut.h str_fun.h \
	interf.h rfd_txte.h sortfd.h initial.h
	$(CC) rfd_fun1.c

list_rfd.o: list_rfd.c refs.h list_rfd.h ix01_fun.h ix02_fun.h fl_ut.h \
	str_fun.h interf.h initial.h fd.h rfd_fun1.h str_refs.h
	$(CC) list_rfd.c

str_refs.o: str_refs.c str_fun.h str_refs.h
	$(CC) str_refs.c

stru_fun.o: stru_fun.c refs.h fd.h str_fun.h fl_ut.h ix01_fun.h \
	sortix01.h ix02_fun.h sortix02.h ix03_fun.h sortix03.h ix04_fun.h \
	sortix04.h interf.h initial.h
	$(CC) stru_fun.c

medl_ir.o: medl_ir.c str_fun.h fl_ut.h refs.h interf.h str_refs.h \
	medl_ir.h ix01_fun.h
	$(CC) medl_ir.c

drec_fun.o: drec_fun.c ix01_fun.h refs.h ix04_fun.h fl_ut.h str_fun.h \
	sortix01.h sortix04.h bbf_fun.h sortbbf1.h interf.h initial.h
	$(CC) drec_fun.c

f_ver.o: f_ver.c refs.h fl_ut.h str_fun.h ix01_fun.h ix02_fun.h \
	ix03_fun.h ix04_fun.h fd.h interf.h
	$(CC) f_ver.c

list_kj.o: list_kj.c fl_ut.h str_fun.h ix02_fun.h refs.h ix03_fun.h \
	interf.h
	$(CC) list_kj.c

list_abs.o: list_abs.c refs.h fl_ut.h str_refs.h ix04_fun.h str_fun.h \
	interf.h initial.h list_abs.h
	$(CC) list_abs.c

refs2tex.o: refs2tex.c refs.h str_fun.h interf.h fl_ut.h refs2tex.h
	$(CC) refs2tex.c

srtf.o: srtf.c str_fun.h fl_ut.h refs.h interf.h srtf.h
	$(CC) srtf.c

xtrrm.o: xtrrm.c str_fun.h fl_ut.h refs.h interf.h str_refs.h xtrrm.h
	$(CC) xtrrm.c


refs43/bin/$(ETEXTEXE) : etext.o interf.o fl_ut.o initial.o str_fun.o \
	file_mg.o recode.o
	$(CLINKER) etext.o interf.o fl_ut.o initial.o str_fun.o \
        file_mg.o recode.o \
	-o refs43/bin/$(ETEXTEXE)

etext.o: etext.c etext.h refs.h interf.h rglobal.h fd.h fl_ut.h initial.h \
	str_fun.h transf.h file_mg.h
	$(CC) etext.c

refs43/bin/$(RADMINEXE): radmin.o str_fun.o fl_ut.o interf.o initial.o \
	recode.o
	$(CLINKER) radmin.o str_fun.o fl_ut.o interf.o initial.o recode.o \
	-o refs43/bin/$(RADMINEXE)

radmin.o: radmin.c refs.h str_fun.h fl_ut.h interf.h initial.h
	$(CC) radmin.c

refs43/bin/$(CP850_TO_LATIN1EXE): cp850-to-latin1.o recode.o str_fun.o \
	fl_ut.o interf.o initial.o
	$(CLINKER) cp850-to-latin1.o recode.o str_fun.o fl_ut.o interf.o \
	initial.o \
	-o refs43/bin/$(CP850_TO_LATIN1EXE)

cp850-to-latin1.o: cp850-to-latin1.c recode.h refs.h fl_ut.h interf.h
	$(CC) cp850-to-latin1.c

recode.o: recode.c recode.h str_fun.h
	$(CC) recode.c

all : 	refs43/bin/$(REFSEXE) refs43/bin/$(ETEXTEXE) refs43/bin/$(RADMINEXE) \
	refs43/bin/$(CP850_TO_LATIN1EXE)

cleanup :
	del  $(ODATS)

clean :
	rm  $(ODATS)

