1# *** makefile.dos ************************************************************
2#
3#  This file is part of BibTool.
4#  It is distributed under the GNU General Public License.
5#  See the file COPYING for details.
6#
7#  (c) 1996-2020 Gerd Neugebauer
8#
9#  Net: gene@gerd-neugebauer.de
10#
11#  This program is free software; you can redistribute it and/or modify
12#  it under the terms of the GNU General Public License as published by
13#  the Free Software Foundation; either version 2, or (at your option)
14#  any later version.
15#
16#  This program is distributed in the hope that it will be useful,
17#  but WITHOUT ANY WARRANTY; without even the implied warranty of
18#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19#  GNU General Public License for more details.
20#
21#  You should have received a copy of the GNU General Public License
22#  along with this program; if not, write to the Free Software
23#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24#
25# *****************************************************************************
26
27#  Look also in the file include/bibtool/config.h for additional
28#  configuration parameters.
29#  Read the file INSTALL for explanation.
30# =============================================================================
31
32#  This is the makefile for BibTool on MSDOS like computers.
33#  This means for machines running MSDOS, OS/2, Windows, WindowsNT
34#  For Linux you should take the file makefile.unx.
35
36# =============================================================================
37#  Configuration Section
38# =============================================================================
39#
40# -------------------------------------------------------
41#  Destination directory for make install
42#  This is usually a directory where public executables
43#  are installed.
44
45BINDIR     = c:\\emtex\\bin
46
47# -------------------------------------------------------
48#  Destination directory for make install.lib
49#  This is usually a directory where public shared files
50#  are installed plus a final BibTool.
51#
52
53LIBDIR     = c:\\emtex\\bibtool
54
55# -------------------------------------------------------
56#  Destination directory for make install.include
57#  This is usually a directory where public include files
58#  are installed plus a final `BibTool'.
59#
60
61INCLUDEDIR = c:\\emtex\\bibtool\\include\\bibtool
62
63# -------------------------------------------------------
64#  Name the C compiler
65#
66
67CC         = gcc
68#  Watcom (MSDOS)
69# CC       = wcl386 /p
70# CC       = wcl386
71#  MSC (MSDOS)
72# CC       = cl
73
74# -------------------------------------------------------
75#  CFLAGS are the flags for the C compiler.
76#  For debugging it should be -g.
77#  For final version you can try to activate
78#  the optimizer with -O or -O2 or whatever
79#  BEWARE: Some C compiler produce erroneous code if the
80# 	   optimizer is turned on.
81#
82
83CFLAGS  =
84#  Watcom (MSDOS)
85# CFLAGS  = -ox
86# CFLAGS  = -d2 -w3
87#  MSC (MSDOS)
88#  The include path is missing since I don't know the approriate switch (yet)
89# CFLAGS  =/AL /Zi /Zd /W4 /D__STDC__
90# CFLAGS  =/AL /Zi /Zd /D__STDC__
91# CFLAGS  =/AL /D__STDC__
92# CFLAGS  =/AL /Ox /D__STDC__
93
94# -------------------------------------------------------
95#  C_INCLUDE are the flags for the C compiler pointing it
96#  to the location of the header files. Usually this
97#  does not need any modifications.
98#
99
100C_INCLUDE  = -Iinclude
101#  Watcom (MSDOS)
102# C_INCLUDE  = -Iinclude
103#  MSC (MSDOS)
104#  The include path is missing since I don't know the approriate switch (yet)
105# C_INCLUDE =
106
107# -------------------------------------------------------
108#  EXT is the optional extension of the final executable.
109#  Various Operating Systems have their own ideas about
110#  that.
111#
112
113EXT		= .exe
114#  Additionally you can select the compiler to use.
115# For MS/DOS computer (emx Compiler)
116# EXT		= .emx
117# For MS/DOS computer (dj Compiler)
118# EXT		= .dj
119# Watcom C 386 (DOS, OS/2, NT)
120# EXT		= .wat
121# Microsoft C 6.00A (DOS, OS/2)
122# EXT		= .msc
123
124# -------------------------------------------------------
125#  Extension of object files
126#
127
128#  Change this to .o for the dj/emx compiler.
129OBJ		= .obj
130
131# -------------------------------------------------------
132#  Name some programs
133#
134#  MV is a command to move certain files maybe to other
135#  directories or drives. Only plain files are moved.
136
137MV		= mv
138
139#  RM is a command to remove certain files. It should not
140#  be confused when trying to remove non-existent files.
141#  Only plain files are removed.
142
143RM		= del
144
145#
146#  MAKEDEPEND is a program to find dependencies for
147#  .c and .h files.
148#  Not present on MSDOS, Atari, Amiga, Next
149MAKEDEPEND	= makedepend
150# MAKEDEPEND	= gcc -MM
151#
152#  INSTALL is a program to properly install some executable files.
153#  Maybe cp should also do this job (on Unix)
154
155INSTALL		= copy
156
157#
158#  INSTALL_DATA is a command to install some data files.
159
160INSTALL_DATA	= copy
161
162#
163#  INSTALL_DIR is a command to create a directory if not
164#  already existent. If your install does not support the
165#  -d option you can try to use mkdir instead.
166
167INSTALL_DIR	= mkdir
168
169#  -------------------------------------------------------
170#  The ranlib program or : for nothing.
171#
172RANLIB	        = ranlib
173
174#  -------------------------------------------------------
175#  The ar program invocation to add files to the archive.
176#
177AR		= ar r
178
179#
180#  PERL is the complet path to an existing perl executable.
181#  Perl 4.* and Perl 5.* are both ok.
182#
183PERL	      = /usr/local/bin/perl
184
185# -------------------------------------------------------
186#  Defines to support (non-ANSI) C compilers.
187#  For Solaris 2 you may have to define HAVE_STRING_H
188#  For ANSI C compilers they should be empty.
189#  Mostly needed for the GNU regex library.
190#  Include
191#  -DHAVE_STRING_H	if your C compiler has string.h
192# 			(e.g. on Solaris 2)
193# 			Maybe you have to enlarge the
194# 			include search path.
195#  -DREGEX_MALLOC	if you have NO alloca() library
196# 			function
197#  -DHAVE_ALLOCA_H	if you need alloca.h for alloca()
198#
199#  -DHAVE_CONFIG_H	if you want to use the file REGEX_DIR/config.h
200# 			this file has to be created then.
201#
202
203NON_ANSI_DEFS = -Dconst=  -DREGEX_MALLOC -DHAVE_STRING_H
204
205# -------------------------------------------------------
206#  GNU Regular Expression Library support.
207#  First of all the (sub)directory containing the
208#  necessary files (excluding trailing slash).
209#
210#  This directory is contained in the BibTool distribution.
211#  I have tried newer versions of this library without
212#  positive results. (Try it if you don't believe me:-)
213#
214REGEX_DIR     = regex-0.12
215#
216
217REGEX_DEF     = -DREGEX -I$(REGEX_DIR)
218
219REGEX         = regex$(OBJ)
220
221# -------------------------------------------------------
222#  Kpathsea Library support.
223#  This library provides means to specify a search path
224#  with recursive search in subdirectories.
225#  The library is NOT contained in the BibTool distribution.
226#  This routines are expected to work with Kpathsea-2.6 or
227#  above.
228#
229#  See the file INSTALL for details.
230#
231#  Kpathsea is not known to work yet on anything else but
232#  Unix platforms.
233#  This item is purely experimental.
234#  Maybe you are better off not trying it!
235#
236#  The value of KPATHSEA_DIR is the directory containing
237#  the distribution of kpathsea. I.e. the directory
238#  containing the subdirectory kpathsea.
239#  The value of KPATHSEA is the name of the kpathsea library.
240#  if kpathsea should not be used then it has to be empty.
241#  The value of KPATHSEA_DEF are the additional flags for the
242#  C compiler. It should arrange things that the macro
243#  KPATHSEA is defined and the directory beneath kpathsea
244#  is in the include search path.
245
246#  Kpathsea is not known to work with 1 yet.
247#  I guess you need to make some modification to the makefile
248#  when you try it. (see makefile.unx for an example)
249#  If you succeed please drop me a mail.
250KPATHSEA_DIR  = ../kpse2-6
251KPATHSEA      =
252KPATHSEA_DEF  =
253#  KPATHSEA     = $(KPATHSEA_DIR)/kpathsea/kpathsea.a
254
255# -------------------------------------------------------
256#  Default search paths
257#  The values are NULL or a string containing a colon
258#  separated list of directories.
259#  DON'T FORGET THE CURRENT DIRECTORY!
260#
261#  The character ENV_SEP separates the directories in
262#  environment search paths.
263#
264
265#  >>> Replace all " in the next three lines with \" for the dj/emx compilers.
266#  >>> This is also required for ; which has to be replaced by \;
267#  >>> Maybe this is also necessary for other compilers.
268BIBINPUTS_DEFAULT = ".;c:\\emtex\\bibinput"
269BIBTOOL_DEFAULT   = ".;c:\\emtex\\bibtool"
270ENV_SEP           = ";"
271
272# -------------------------------------------------------
273#  Declare the file naming conventions.
274#  FILE_TYPES contains optionally a macro definition
275#  determining the file naming conventions.
276#  -DMSDOS denotes MSDOG-like file names. (Also for Atari)
277#  -DAMIGA denotes the Amiga file names.
278#  The default (empty) are UN*X-like file names.
279#
280#  DIR_SEP is the directory-file separator.
281
282FILE_TYPES	  = -DMSDOS
283DIR_SEP		  = \\
284
285# =============================================================================
286#  End of Configuration Section
287# =============================================================================
288
289MAKE_FILE      =
290
291RSC_DEF	      = -DRSC_BIBINPUTS_DEFAULT=$(BIBINPUTS_DEFAULT)		\
292		-DRSC_BIBTOOL_DEFAULT=$(BIBTOOL_DEFAULT)		\
293		-DENV_SEP=$(ENV_SEP)
294
295DONT_LINK     = -c
296LINK_TO       = -o
297STANDALONE    = -DSTANDALONE
298
299C_FLAGS	      = $(C_INCLUDE) $(CFLAGS) $(FILE_TYPES)
300
301CFILES	      = main.c		\
302		$(CLIBFILES)
303CLIBFILES     = database.c	\
304		crossref.c	\
305		entry.c		\
306		error.c		\
307		expand.c	\
308		init.c		\
309		io.c		\
310		key.c		\
311		macros.c	\
312		names.c		\
313		parse.c		\
314		print.c		\
315		pxfile.c	\
316		record.c	\
317		rewrite.c	\
318		rsc.c		\
319		s_parse.c	\
320		symbols.c	\
321		stack.c		\
322		sbuffer.c	\
323		tex_aux.c	\
324		tex_read.c	\
325		version.c	\
326		type.c		\
327		wordlist.c
328
329HPATH	      = include${DIR_SEP}bibtool${DIR_SEP}
330HFILES	      = config.h		\
331		${HPATH}database.h	\
332		${HPATH}crossref.h	\
333		${HPATH}bibtool.h	\
334		${HPATH}config.h	\
335		${HPATH}entry.h		\
336		${HPATH}error.h		\
337		${HPATH}expand.h	\
338		${HPATH}general.h	\
339		${HPATH}init.h		\
340		${HPATH}io.h		\
341		${HPATH}key.h		\
342		${HPATH}keynode.h	\
343		${HPATH}macros.h	\
344		${HPATH}names.h		\
345		${HPATH}parse.h		\
346		${HPATH}print.h		\
347		${HPATH}pxfile.h	\
348		${HPATH}record.h	\
349		${HPATH}regex.h		\
350		${HPATH}resource.h	\
351		${HPATH}rewrite.h	\
352		${HPATH}rsc.h		\
353		${HPATH}s_parse.h	\
354		${HPATH}sbuffer.h	\
355		${HPATH}stack.h		\
356		${HPATH}symbols.h	\
357		${HPATH}tex_aux.h	\
358		${HPATH}tex_read.h	\
359		${HPATH}type.h		\
360		${HPATH}version.h	\
361		${HPATH}wordlist.h
362
363OFILES	      = main$(OBJ)	\
364		$(OLIBFILES)
365OLIBFILES     = database$(OBJ)	\
366		crossref$(OBJ)	\
367		entry$(OBJ)	\
368		error$(OBJ)	\
369		expand$(OBJ)	\
370		init$(OBJ)	\
371		io$(OBJ)	\
372		key$(OBJ)	\
373		macros$(OBJ)	\
374		names$(OBJ)	\
375		parse$(OBJ)	\
376		print$(OBJ)	\
377		pxfile$(OBJ)	\
378		record$(OBJ)	\
379		rewrite$(OBJ)	\
380		rsc$(OBJ)	\
381		s_parse$(OBJ)	\
382		symbols$(OBJ)	\
383		stack$(OBJ)	\
384		sbuffer$(OBJ)	\
385		tex_aux$(OBJ)	\
386		tex_read$(OBJ)	\
387		type$(OBJ)	\
388		version$(OBJ)	\
389		wordlist$(OBJ)
390
391DOCFILES      = doc$(DIR_SEP)bibtool.1		\
392		doc$(DIR_SEP)bibtool.tex	\
393		doc$(DIR_SEP)bibtool.bib	\
394		doc$(DIR_SEP)bibtool.bbl	\
395		doc$(DIR_SEP)bibtool.aux	\
396		doc$(DIR_SEP)bibtool.ind	\
397		doc$(DIR_SEP)bibtool.idx	\
398		doc$(DIR_SEP)bibtool.ist	\
399		doc$(DIR_SEP)config.tex		\
400		doc$(DIR_SEP)version.tex	\
401		doc$(DIR_SEP)ref_card.tex	\
402		doc$(DIR_SEP)Makefile		\
403		doc$(DIR_SEP)c_get.pl		\
404		doc$(DIR_SEP)c_lib.tex
405
406LIBFILES      = lib$(DIR_SEP)biblatex.rsc	\
407		lib$(DIR_SEP)braces.rsc		\
408		lib$(DIR_SEP)check_y.rsc	\
409		lib$(DIR_SEP)default.rsc	\
410		lib$(DIR_SEP)field.rsc		\
411		lib$(DIR_SEP)improve.rsc	\
412		lib$(DIR_SEP)iso2tex.rsc	\
413		lib$(DIR_SEP)keep_bibtex.rsc	\
414		lib$(DIR_SEP)keep_biblatex.rsc	\
415		lib$(DIR_SEP)month.rsc		\
416		lib$(DIR_SEP)opt.rsc		\
417		lib$(DIR_SEP)sort_fld.rsc	\
418		lib$(DIR_SEP)tex_def.rsc
419
420PROGFILES     = Perl$(DIR_SEP)bibtool.pl	\
421		Tcl$(DIR_SEP)bibtool.tcl
422ETCFILES      = README.md			\
423		INSTALL				\
424		COPYING				\
425		Changes.tex			\
426		makefile.unx			\
427		makefile.dos			\
428		makefile.ata			\
429		makefile.ami			\
430		ToDo				\
431		THANKS				\
432		pxfile.man			\
433		sbuffer.man			\
434		doc$(DIR_SEP)c.tex		\
435		doc$(DIR_SEP)c_main.tex		\
436		doc$(DIR_SEP)c_lib.ind		\
437		$(MSDOS_targets)		\
438		$(PROGFILES)			\
439		$(AUTOCONFFILES)		\
440		$(BIBTCLFILES)
441
442AUTOCONFFILES = configure			\
443		configure.ac			\
444		install-sh			\
445		mkdirchain			\
446		AutoConf$(DIR_SEP)config.h.in	\
447		AutoConf$(DIR_SEP)makefile.in	\
448		AutoConf$(DIR_SEP)reconfig.h.in
449
450BIBTCLFILES   = BibTcl$(DIR_SEP)Makefile.in	\
451		BibTcl$(DIR_SEP)README		\
452		BibTcl$(DIR_SEP)bibtool.c	\
453		BibTcl$(DIR_SEP)bibtcl.tex	\
454		BibTcl$(DIR_SEP)bibtcl.ltx	\
455		BibTcl$(DIR_SEP)bibtcl.bib	\
456		BibTcl$(DIR_SEP)version.tex	\
457		BibTcl$(DIR_SEP)configure.in	\
458		BibTcl$(DIR_SEP)configure	\
459		BibTcl$(DIR_SEP)dina4.sty	\
460		BibTcl$(DIR_SEP)bibtool.ist	\
461		BibTcl$(DIR_SEP)main.tcl
462
463DISTFILES     = $(ETCFILES)			\
464		$(CFILES)			\
465		$(HFILES)			\
466		$(LIBFILES)			\
467		$(DOCFILES)			\
468		$(REGEX_DIR)
469
470# -----------------------------------------------------------------------------
471#  The main target
472# -----------------------------------------------------------------------------
473
474default all: bibtool$(EXT)
475
476emx: bibtool.emx
477bibtool.emx: $(OFILES) $(REGEX) $(KPATHSEA)
478	$(CC) $(C_FLAGS) -o bibtool.emx $(OFILES) $(REGEX) $(KPATHSEA)
479	emxbind -b -q $(EMXGPP)/bin/emx.exe bibtool.emx bibtool.exe
480
481dj: bibtool.dj
482bibtool.exe bibtool.dj: $(OFILES) $(REGEX)  $(KPATHSEA) link.dj
483	$(CC) $(C_FLAGS) -o bibtool.exe @link.dj
484#  Alternative:
485# 	$(CC) $(C_FLAGS) -o bibtool.dj @link.dj
486# 	copy /b $(DJGPPDOS)\bin\go32.exe+bibtool.dj bibtool.exe
487
488wat: bibtool.wat
489bibtool.wat:  $(OFILES) $(REGEX) $(KPATHSEA) link.wat
490	wcl386 /x /fe=bibtool.exe @link.wat
491
492msc: bibtool.msc
493bibtool.msc:  $(OFILES) $(REGEX) $(KPATHSEA) link.msc
494	link /farcall/noi @link.msc,bibtool.exe,nul,/nod:llibce llibcep;
495	bind bibtool.exe
496	exehdr /pmtype:windowcompat bibtool.exe
497
498tex_read$(EXT): tex_read.c
499	$(CC) $(C_FLAGS) $(STANDALONE) tex_read.c $(LINK_TO) tex_read$(EXT)
500
501tex_aux$(OBJ): tex_aux.c
502	$(CC) $(C_FLAGS) $(REGEX_DEF) $(DONT_LINK) tex_aux.c
503
504main$(OBJ): main.c
505	$(CC) $(C_FLAGS) $(REGEX_DEF) $(KPATHSEA_DEF) $(DONT_LINK) main.c
506
507init$(OBJ): init.c
508	$(CC) $(C_FLAGS) $(KPATHSEA_DEF) $(DONT_LINK) init.c
509
510io$(OBJ): io.c
511	$(CC) $(C_FLAGS) $(KPATHSEA_DEF) $(DONT_LINK) io.c
512
513parse$(OBJ): parse.c
514	$(CC) $(C_FLAGS) $(KPATHSEA_DEF) $(DONT_LINK) parse.c
515
516rewrite$(OBJ): rewrite.c
517	$(CC) $(C_FLAGS) $(REGEX_DEF) $(DONT_LINK) rewrite.c
518
519rsc$(OBJ): rsc.c
520	$(CC) $(C_FLAGS) $(RSC_DEF) $(DONT_LINK) rsc.c
521
522.c$(OBJ):
523	$(CC) $(C_FLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
524
525# __________________________________________________________________
526#  Include the makefile into the dependencies to force updates
527#  when the makefile is modified.
528$(OFILES): $(MAKE_FILE)
529
530# __________________________________________________________________
531#  Targets from the GNU Regular Expression Library.
532
533regex$(OBJ): $(REGEX_DIR)$(DIR_SEP)regex.c $(MAKE_FILE)
534	$(CC) $(C_FLAGS) -I$(REGEX_DIR) $(NON_ANSI_DEFS) $(REGEX_DIR)$(DIR_SEP)regex.c $(DONT_LINK) -o $@
535
536# -----------------------------------------------------------------------------
537#  General development targets
538# -----------------------------------------------------------------------------
539
540CLEAN_TARGETS	= *$(OBJ) *.bak
541
542clean:
543	-$(RM) $(CLEAN_TARGETS)
544
545veryclean: clean
546	-$(RM) bibtool
547
548# -------------------------------------------------------
549#  Some support for MSDOS-like computers.
550.c.obj:
551	$(CC) $(C_FLAGS) -c $<
552.c.o:
553	$(CC) $(C_FLAGS) -c $<
554
555libbib.a: $(OLIBFILES)
556	$(AR) $@ $(OLIBFILES) regex.o
557	$(RANLIB) $@
558
559install: install.bin install.lib
560
561install.bin: bibtool$(EXT)
562	-$(INSTALL_DIR) $(BINDIR)
563	$(INSTALL) bibtool$(EXT) $(BINDIR)
564
565INSTALL_LIB_FILES = lib$(DIR_SEP)*.*
566
567install.lib:
568	-$(INSTALL_DIR) $(LIBDIR)
569	$(INSTALL_DATA) $(INSTALL_LIB_FILES) $(LIBDIR)
570
571install.include:
572	-$(INSTALL_DIR) $(INCLUDEDIR)
573	$(INSTALL_DATA) $(INSTALL_INCLUDE_FILES) $(INCLUDEDIR)
574
575install.man:
576
577uninstall.bin:
578	-$(RM) $(BINDIR)$(DIR_SEP)bibtool$(EXT)
579
580uninstall.lib:
581	-$(RM) $(LIBDIR)
582
583uninstall.include:
584	-$(RM) $(INCLUDEDIR)
585
586uninstall.man:
587
588status:
589	@echo $(LIBDIR)
590
591# =============================================================================
592# DO NOT DELETE THIS LINE -- make depend depends on it.
593main.o database.o entry.o error.o expand.o init.o key.o macros.o names.o parse.o print.o pxfile.o record.o rewrite.o rsc.o s_parse.o symbols.o stack.o sbuffer.o tex_aux.o tex_read.o type.o version.o wordlist.o: config.h include/bibtool/database.h include/bibtool/bibtool.h include/bibtool/config.h include/bibtool/entry.h include/bibtool/error.h include/bibtool/expand.h include/bibtool/general.h include/bibtool/init.h include/bibtool/key.h include/bibtool/keynode.h include/bibtool/macros.h include/bibtool/names.h include/bibtool/parse.h include/bibtool/print.h include/bibtool/pxfile.h include/bibtool/record.h include/bibtool/regex.h include/bibtool/resource.h include/bibtool/rewrite.h include/bibtool/rsc.h include/bibtool/s_parse.h include/bibtool/sbuffer.h include/bibtool/stack.h include/bibtool/symbols.h include/bibtool/tex_aux.h include/bibtool/tex_read.h include/bibtool/type.h include/bibtool/version.h include/bibtool/wordlist.h main.c database.c entry.c error.c expand.c init.c key.c macros.c names.c parse.c print.c pxfile.c record.c rewrite.c rsc.c s_parse.c symbols.c stack.c sbuffer.c tex_aux.c tex_read.c version.c type.c wordlist.c
594