Upgrading to GitLab 11.11.0.

Commit acb78720 authored by Markus Koschany's avatar Markus Koschany

Imported Upstream version 1.7.12~a+ds

parent 68e50cb7
File mode changed from 100755 to 100644
Distribution file list and directory structure
Copyright (c) 2002-2008 by Christopher Heng. All rights reserved.
-----------------------------------------------------------------
Copyright 2002-2012 by Christopher Heng. All rights reserved.
-------------------------------------------------------------
# Main directory
......@@ -33,10 +33,6 @@ src\
# Makefiles for other MSDOS/Windows compilers
makefile.bc Borland C++ 4.5x/5.0x Makefile
makefile.dj2 DJGPP 2.X Makefile
makefile.dm Digital Mars Makefile
makefile.lcc LCC-Win32 Makefile
makefile.min MinGW Makefile
makefile.wcc Watcom Makefile
makefile.vs7 Visual Studio .NET 2003 makefile
......@@ -50,7 +46,7 @@ src\
src\lib\
mktemp.c mktemp() for deficient systems
mktemp.c mkstemp() for deficient systems
mktemp.h
getopt.c getopt() for deficient systems
getopt.h
......
This diff is collapsed.
# makefile.gcc Makefile for building with the GNU C compiler on Linux.
# Copyright (c) 1996-2005 by Christopher Heng. All rights reserved.
# $Id: makefile.gcc,v 1.2 2005/03/06 05:40:49 chris Exp $ /*
# Copyright 1996-2012 by Christopher Heng. All rights reserved.
# This makefile requires the GNU make to work (we use the GNU extensions).
......@@ -18,10 +16,6 @@ CDEBUG = -O2
LDEBUG = -s
endif
ifndef VERSTR
VERSTR = 0.0
endif
# programs
CC = gcc
CD = cd
......@@ -34,8 +28,6 @@ MAKE = make
MKDIR = mkdir
MV = mv
RM = rm -f
TAR = tar
ZIP = zip
# flags
CFLAGS = $(DEFINES) $(TFLAG) $(CDEBUG) -c -Wall
......@@ -45,50 +37,20 @@ INSTALLDATAFLAGS = -m 644
LDFLAGS = $(LDEBUG)
LNFLAGS = -sf
RMRECURFLAGS = -rf
TARFLAGS = cvf
ZIPSRCFLAGS = -r -9
# directories
BINDIR = /usr/bin
DISTDIR = tofrodos-$(VERSTR)
LIBDIR = lib
LIBDISTDIR = $(DISTDIR)/lib
MANDIR = /usr/man/man1
# filenames
FROMDOS = fromdos
FROMDOSMAN = fromdos.1
FROMDOSTXT = fromdos.txt
TARGZNAME = $(TARNAME).gz
TARNAME = tofrodos-$(VERSTR).tar
TODOS = todos
ZIPSRCNAME = tfd.zip
# lists of filenames
DISTFILES = config.h \
copying \
emsg.c \
emsg.h \
fromdos \
init.c \
makefile.bc \
makefile.gcc \
makefile.vc \
makefile.wcc \
readme.txt \
todos16.exe \
todos32.exe \
tofrodos.c \
tofrodos.h \
tofrodos.lsm \
utility.c \
utility.h \
version.h \
$(FROMDOSMAN)
LIBDISTFILES = $(LIBDIR)/getopt.c \
$(LIBDIR)/getopt.h \
$(LIBDIR)/mktemp.c \
$(LIBDIR)/mktemp.h
OBJS = emsg.o \
init.o \
tofrodos.o \
......@@ -107,17 +69,6 @@ clean:
clobber: clean
$(RM) $(FROMDOS) $(TODOS)
dist: $(DISTFILES) $(DISTDIR) $(LIBDISTDIR)
$(CP) $(DISTFILES) $(DISTDIR)
$(CP) $(LIBDISTFILES) $(LIBDISTDIR)
$(MV) $(DISTDIR)/makefile.gcc $(DISTDIR)/Makefile
$(MV) $(DISTDIR)/copying $(DISTDIR)/COPYING
$(MV) $(DISTDIR)/readme.txt $(DISTDIR)/README.TXT
($(CD) $(DISTDIR) ; $(LN) $(LNFLAGS) fromdos todos)
distclean: clobber
$(RM) $(RMRECURFLAGS) $(DISTDIR)
install: installman
$(INSTALL) $(INSTALLBINFLAGS) $(FROMDOS) $(BINDIR)
($(CD) $(BINDIR) ; $(LN) $(LNFLAGS) fromdos todos)
......@@ -126,16 +77,8 @@ installman: $(FROMDOSMAN)
$(INSTALL) $(INSTALLDATAFLAGS) $(FROMDOSMAN) $(MANDIR)
($(CD) $(MANDIR) ; $(LN) $(LNFLAGS) fromdos.1 todos.1)
save:
$(ZIP) $(ZIPSRCFLAGS) $(ZIPSRCNAME) *
tardist: $(TARGZNAME)
# real rules
$(DISTDIR):
$(MKDIR) $(DISTDIR)
$(FROMDOS): $(OBJS)
$(CC) $(LDFLAGS) -o $(FROMDOS) $(OBJS)
......@@ -143,13 +86,6 @@ $(FROMDOSTXT): $(FROMDOSMAN)
gtbl $(FROMDOSMAN) | groff -Tascii -mandoc | \
troff -Tascii -mandoc | grotty > $@
$(LIBDISTDIR):
$(MKDIR) $(LIBDISTDIR)
$(TARGZNAME): dist
$(TAR) $(TARFLAGS) $(TARNAME) $(DISTDIR)
$(GZIP) $(GZIPFLAGS) $(TARNAME)
$(TODOS): $(FROMDOS)
$(LN) $(LNFLAGS) $(FROMDOS) $(TODOS)
......@@ -159,17 +95,3 @@ init.o: init.c config.h emsg.h tofrodos.h utility.h version.h
tofrodos.o: tofrodos.c config.h emsg.h tofrodos.h utility.h version.h
utility.o: utility.c config.h emsg.h tofrodos.h utility.h
# The following information is for the information of the maintainer of
# the package only.
# To make the distribution tar file, you need to define VERSTR to the
# version number. Eg, for a version 1.0 release, define VERSTR=1.0
# Hence a make command line would read
# make VERSTR=1.0 tardist
# If VERSTR is not defined at any time, it defaults to 0.0 (to remind
# you that you forgot something!).
#
# Before making tardist, you need to compile in DOS first.
/*
config.h Handles system dependencies.
Copyright (c) 1996-2008 by Christopher Heng. All rights reserved.
Copyright (c) 1996-2012 by Christopher Heng. All rights reserved.
*/
/*
......@@ -22,7 +22,7 @@
MSDOS MSDOS
WIN32 WIN32
2. You need a getopt() implementation. It must support the
2. You will need a getopt() implementation. It must support the
usual behaviour of the Unix getopt(), plus the variables
optind, opterr, and optarg.
......@@ -41,9 +41,9 @@
4. Note that on MSDOS systems, you will need _splitpath()
and _makepath(). If you use DJGPP, you probably can get away
with defining _splitpath() to call fnsplit(), etc (which I have
done below). Otherwise, you will need to roll your own version.
I think all the commercial MSDOS C compilers have these functions.
with defining _splitpath() to call fnsplit(), etc. Otherwise,
you will need to roll your own version. I think all the
commercial MSDOS C compilers have these functions.
5. You will also need stricmp() and strnicmp() on MSDOS or
strcasecmp() or strncasecmp() on Unix. If you have stricmp() and/or
......@@ -54,22 +54,16 @@
defining UNIX here will cause the compiler to use strcasecmp()
and strncasecmp().
6. You will need a mktemp(). On Unix systems, this is probably
6. You will need mkstemp(). On Unix systems, this is probably
declared in <unistd.h>.
Digital Mars declares mktemp() in io.h.
I have supplied my own mktemp.c and mktemp.h for use with the
Open Watcom C (Windows/DOS) and Visual C++ (Windows) compilers
that includes my implementation of mkstemp(). If your system
does not have mkstemp(), you might try to see if you can use
this. (It's in the lib directory.)
Borland declares mktemp() in dir.h. If you are writing or using
a replacement mktemp() you should put the prototype in a
header called mktemp.h and define HAVE_MKTEMP_H.
Visual C++ declares mktemp() in io.h.
I have supplied my own mktemp.c and mktemp.h for use with
Watcom C/C++ 10.X since these versions of the compiler do not
have mktemp().
If your compiler has mktemp() declared somewhere else (other
If your compiler has mkstemp() declared somewhere else (other
than unistd.h on Unix), define MKTEMP_HEADER to be the name
of the header, eg <whatever.h> (include the angle brackets or
double quotes), and HAVE_MKTEMP_H to force inclusion of the
......@@ -121,9 +115,6 @@ extern "C" {
#if !defined(WIN32)
#define WIN32
#endif
#if defined(__BORLANDC__) && defined(MSDOS) /* Borland always defines MSDOS */
#undef MSDOS
#endif
#endif
#if defined(__APPLE__)
......@@ -140,53 +131,18 @@ extern "C" {
#define HAVE_UNISTD_H
#endif
#if defined(__WATCOMC__) /* this works on my system only */
#if !defined(HAVE_GETOPT_H)
#define HAVE_GETOPT_H
#endif
#if defined(WIN32) || defined(MSDOS)
#if !defined(HAVE_MKTEMP_H)
#define HAVE_MKTEMP_H
#endif
#if !defined(MKTEMP_HEADER)
#define MKTEMP_HEADER <mktemp.h>
#endif
#endif
#if defined(__BORLANDC__) /* Borland declares mktemp() in dir.h */
#if !defined(HAVE_GETOPT_H)
#define HAVE_GETOPT_H
#endif
#if !defined(HAVE_MKTEMP_H)
#define HAVE_MKTEMP_H
#endif
#if !defined(MKTEMP_HEADER)
#define MKTEMP_HEADER <dir.h>
#endif
#endif
#if defined(__SC__) /* Digital Mars declares mktemp() in <io.h> */
#if !defined(HAVE_GETOPT_H)
#define HAVE_GETOPT_H
#endif
#endif
#if defined(__LCC__) /* LCC-Win32 compiler declares mktemp() in io.h */
#if !defined(HAVE_GETOPT_H)
#define HAVE_GETOPT_H
#endif
#endif
#if defined(_MSC_VER) /* Visual C++ declares mktemp() in <io.h> */
/* which is already included for other reasons. */
#if !defined(HAVE_GETOPT_H)
#define HAVE_GETOPT_H
#endif
#endif
#if defined(__DJGPP__) || defined(__GO32__)
#define HAVE_UNISTD_H /* djgpp has unistd.h which also defines getopt() */
#endif
#if defined(__MINGW32__)
#define HAVE_GETOPT_H
#endif
......@@ -203,20 +159,9 @@ extern "C" {
#endif
#endif
/* if you are using a Unix-type system that has the function mkstemp() */
/* define HAVE_MKSTEMP here. If not, just leave it undefined; */
/* mktemp() will be used instead. */
#if defined(LINUX)
#define HAVE_MKSTEMP
#endif
/* Borland, Digital Mars, LCC-Win32, Microsoft's compiler have */
/* S_IREAD and S_IWRITE in their sys/stat.h instead of S_IRUSR */
/* and S_IWUSR which are used by the Unix and Watcom compilers. */
/* Borland's 4.52 compiler however defines these in its 32 bit */
/* compiler. Since I can't be sure which versions have already */
/* defined these, I define it for all Borland 32 bit targets. */
#if defined(_MSC_VER) || defined(__SC__) || defined(__LCC__) || (defined(__BORLANDC__) && !defined(__FLAT__))
/* Microsoft's compiler havs S_IREAD and S_IWRITE in its sys/stat.h */
/* but not S_IRUSR and S_IWUSR which I use. */
#if defined(_MSC_VER)
#define S_IRUSR S_IREAD
#define S_IWUSR S_IWRITE
#endif
......@@ -245,18 +190,6 @@ extern "C" {
/* End of block that is relevant for Unix-type systems only */
/* djgpp does not have _splitpath() and _makepath(), but they do have */
/* functional equivalents which are declared in <dir.h> */
#if defined(__DJGPP__) || defined(__GO32__)
#define _splitpath fnsplit
#define _makepath fnmerge
#endif
/* Later versions of LCC-Win32 no longer declares utime() */
#if defined(__LCC__)
#define utime(a,b) _utime(a,b)
#endif
#if defined(__cplusplus)
}
#endif
......
/*
emsg.c Initialisation functions.
Copyright (c) 2005 by Christopher Heng. All rights reserved.
emsg.c Error message printing functions.
Copyright (c) 2005-2012 by Christopher Heng. All rights reserved.
$Id: emsg.c,v 1.3 2005/03/14 14:18:40 chris Exp $
*/
/* this should always be first */
......
/*
emsg.h Error messages.
Copyright (c) 1996-2003 by Christopher Heng. All rights reserved.
$Id: emsg.h,v 1.4 2005/03/14 14:18:40 chris Exp $
Copyright (c) 1996-2012 by Christopher Heng. All rights reserved.
*/
#if !defined(EMSG_H_INCLUDED)
......@@ -16,29 +14,29 @@ extern "C" {
#define EMSG_BAKFILENAME "File cannot have a .bak extension "\
"when used with -b flag.\n"
#define EMSG_CONVERT "File read/write error while "\
"converting %s.\n"
"converting \"%s\".\n"
#define EMSG_INTERNAL "Internal error: %s.\n"
#define EMSG_NOFILENAME "Need to specify filename or redirect "\
"stdin.\n"
#define EMSG_NOMEM "Insufficient memory to run program.\n"
#define EMSG_NOTEMPNAME "Unable to create temporary file for converting %s.\n"
#define EMSG_OPENFILE "Unable to open file %s.\n"
#define EMSG_NOTEMPNAME "Unable to generate temporary filename for converting \"%s\".\n"
#define EMSG_OPENFILE "Unable to open file \"%s\".\n"
#define EMSG_SIGNAL "Terminated by user.\n"
#define EMSG_WRONGDOSVER "Requires DOS 3.1 and above.\n"
#define EMSG_ACCESSFILE "Unable to access file %s.\n"
#define EMSG_NOTREADABLE "No read permission for %s.\n"
#define EMSG_NOTWRITEABLE "No write permission for %s. Use -f to force conversion.\n"
#define EMSG_CHOWN "Unable to change ownership of %s.\n"
#define EMSG_SYMLINK "Unable to dereference symbolic link %s.\n"
#define EMSG_CREATETEMP "Unable to create temporary file %s for converting %s.\n"
#define EMSG_ERRORLOG "%s: Unable to create error log file %s. Defaulting to stderr.\n" /* special case with progname */
#define EMSG_ACCESSFILE "Unable to access file \"%s\".\n"
#define EMSG_NOTREADABLE "No read permission for \"%s\".\n"
#define EMSG_NOTWRITEABLE "No write permission for \"%s\". Use -f to force conversion.\n"
#define EMSG_CHOWN "Unable to change ownership of \"%s\".\n"
#define EMSG_SYMLINK "Unable to dereference symbolic link \"%s\".\n"
#define EMSG_CREATETEMP "Unable to create temporary file \"%s\" for converting \"%s\".\n"
#define EMSG_ERRORLOG "%s: Unable to create error log file \"%s\". Defaulting to stderr.\n" /* special case with progname */
/* internal error macros */
#define EINTNL_DIRECTION "unknown direction"
/* verbose messages */
#define VERBOSE_CONVERTING "Converting %s\n"
#define VERBOSE_SYMLINKSRC "%s resolves to %s\n"
#define VERBOSE_CONVERTING "Converting \"%s\"\n"
#define VERBOSE_SYMLINKSRC "\"%s\" resolves to \"%s\"\n"
/* function declarations */
extern void emsg ( char * message, ... );
......
.TH tofrodos 1 "Version 1.7.9" "2011"
.TH tofrodos 1 "Version 1.7.12" "2012"
.SH NAME
tofrodos
\- Converts text files between DOS and Unix formats.
......@@ -38,14 +38,14 @@ linefeeds to carriage return pairs. The default is to convert linefeeds
only if they are not already preceded by a carriage return.
.TP
.BI \-b
Make a backup of original file. The original
file is renamed with the original filename and a
Make a backup of original file. The original file with a
.I .bak
extension. For example, a file called "filename.ext" becomes "filename.ext.bak".
extension appended to the original filename, silently replacing any existing file of that name.
For example, a file called "filename.ext" becomes "filename.ext.bak" replacing any existing file
having the name "filename.ext.bak".
Important: the program behaves differently if it is compiled for DOS (as compared to being compiled for Windows, Linux,
Mac OS X or other systems). In view of the filename restrictions present on DOS, the DOS executable
will strip the original file extension, if any, from the file
before appending the
will strip the original file extension, if any, from the file before appending the
.I .bak
extension. For example, "filename.ext" becomes "filename.bak".
.TP
......@@ -95,10 +95,11 @@ command line option error will be issued to stderr instead and not logged.
Overwrite the original file (no backup). This is the default.
.TP
.BI \-p
Preserve file ownership and time. On systems like Linux, the file
ownership will only be preserved if the user is root, otherwise it
Preserve file ownership and time on Unix-type systems (like Linux). On Windows and MSDOS, it only
preserves the file time. Note that on many Unix-type systems, including Linux, the file
ownership will only be preserved if the program is run as root, otherwise it
will just set the file time and silently fail the change of file
ownership. If you want a warning message when the file ownership
ownership. On such systems, if you want a warning message when the file ownership
cannot be changed, use \-v.
.TP
.BI \-u
......@@ -111,8 +112,15 @@ Verbose.
.TP
.BI \-V
Show version message and quit.
.SH EXIT CODE
Tofrodos terminates with an exit code of 0 on success and 1 on error.
.PP
If the program is invoked with multiple files on the command line, the default behaviour is to skip to the next
file in the list if an error is encountered with any file. In such a case, the exit code returned will the
status of the last file processed (ie, 0 on success, 1 on failure). If this is not desirable, use the \-e option,
which will force the program to abort immediately with the appropriate exit code on encountering any error.
.SH AUTHOR
The program and its documentation are copyrighted (c) 1996-2008 by
The program and its documentation are copyrighted (c) 1996-2012 by
Christopher Heng. All rights reserved. They are distributed under
the terms of the GNU General Public License Version 2.
.PP
......
/*
init.c Initialisation functions.
Copyright 1996-2011 Christopher Heng. All rights reserved.
Copyright 1996-2012 Christopher Heng. All rights reserved.
*/
/* this should always be first */
......@@ -20,10 +20,6 @@
#include <unistd.h>
#endif
#if defined(__DJGPP__) || defined(__GO32__)
#include <dir.h>
#endif
/* our own headers */
#include "emsg.h"
#include "tofrodos.h"
......@@ -48,7 +44,7 @@
#define OPTLIST "abdefhl:opuvV"
#define VERFMT "%s Ver %d.%d.%d "\
"Converts text files between DOS and Unix formats.\n"\
"Copyright 1996-2011 Christopher Heng. "\
"Copyright 1996-2012 Christopher Heng. "\
"All rights reserved.\n"
#if defined(MSDOS) || defined(WIN32)
......@@ -85,7 +81,7 @@ int init ( char * firstarg )
char * s ;
#endif
#if defined(MSDOS) && !defined(__DJGPP__) && !defined(__GO32__)
#if defined(MSDOS)
/* Check that we have the minimum version of DOS needed. */
/* We only run on DOS 3.1 and above. */
if (_osmajor < 3 ||
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
/*
mktemp.c Create a temporary file name.
Copyright (c) 1996,1997 by Christopher Heng. All rights reserved.
$Id: mktemp.c,v 1.1 2004/10/01 12:33:39 chris Exp $
Copyright 1996-2012 by Christopher Heng. All rights reserved.
This code is released under the terms of the GNU General Public
License Version 2. You should have received a copy of the GNU
......@@ -10,43 +8,50 @@
Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
USA.
The mktemp() function does not exist in the Watcom 10.[0-6] library.
Originally written for use in tofrodos, when compiled with
Watcom 10.0, which did not have either mktemp() or mkstemp().
Tofrodos can be found at
http://www.thefreecountry.com/tofrodos/index.shtml
*/
#include <errno.h> /* errno, ENOENT */
#include <errno.h> /* errno, ENOENT, EINVAL, EEXIST */
#include <io.h> /* access() */
#include <string.h> /* strlen(), strcmp() */
#include <sys/types.h>
#include <sys/stat.h> /* O_IRUSR, O_IWUSR */
#include <fcntl.h> /* open(), O_RDWR, O_CREAT, O_EXCL */
#include "mktemp.h" /* our own header */
#define MAXVAL (65535u) /* unsigned is at least this (ANSI) */
/*
mktemp
mkstemp
Returns a string containing a temporary filename.
Creates a temporary file using "templ" and returns a
file descriptor opened using open(). The file is
open for read and write binary (not text) access
for the current user. The new filename is placed
in "templ", overwriting its existing contents.
The caller must initialise "templ" to contain 6 trailing
'X's. mktemp() will directly modify the templ contents,
replacing the 'X's with the filename.
The file path in "templ" must have six trailing "X"s,
ie, it must end with "XXXXXX".
WARNING: your prefix in "templ" + the six trailing 'X's,
must not exceed the DOS filesystem naming limitations or
unpredictable results may occur. For example, since a filename
cannot exceed 8 characters in length, you cannot call
mktemp() with a templ of "mytempXXXXXX". Note that
"unpredictable results" does not mean that mktemp() will
return NULL. It means exactly that _unpredictable_ results
will occur (probably depending on your prefix).
On success, mkstemp() returns the file descriptor.
On failure, it returns -1, and errno is set to
EINVAL if "templ" does not end with "XXXXXX" on
entry to the function, or EEXIST if no file could
be created.
Returns: - pointer to "templ" on success;
- NULL on failure. Note that even if NULL is returned,
the "templ" contents would have been changed
as well.
Function compatibility:
O_BINARY is used in file creation. This flag
only exists on Windows and MSDOS compilers.
Example:
char tempfilename[] = "\\tmp\\myXXXXXX" ;
int fd ;
fd = mkstemp( tempfilename );
*/
char * mktemp ( char * templ )
int mkstemp ( char * templ )
{
static unsigned val ;
static char fch = 'A' ;
......@@ -55,13 +60,19 @@ char * mktemp ( char * templ )
char *startp ;
size_t len ;
unsigned tval ;
int fd ;
int orig_errno ;
orig_errno = errno ;
/* do some sanity checks */
/* make sure that templ is at least 6 characters long */
/* and comprises the "XXXXXX" string at the end */
if ((len = strlen(templ)) < 6 ||
strcmp( (s = startp = templ + len - 6), MKTEMP_TEMPLATE ))
return NULL ;
strcmp( (s = startp = templ + len - 6), MKTEMP_TEMPLATE )) {
errno = EINVAL ;
return -1 ;
}
for ( ; fch <= 'Z'; val = 0, fch++ ) {
/* plug the first character */
*startp = fch ;
......@@ -77,9 +88,12 @@ char * mktemp ( char * templ )
*s = (char) ((tval % 10) + '0') ;
tval /= 10 ;
}
if (access( templ, 0 ) == -1 && errno == ENOENT)
return templ ;
if ((fd = open( templ, O_CREAT | O_EXCL | O_BINARY | O_RDWR, S_IRUSR | S_IWUSR )) != -1) {
errno = orig_errno ;
return fd ;
}
}
}
return NULL ;
errno = EEXIST ;
return -1 ;
}
/*
mktemp.h Declares my mktemp() function.
Copyright (c) 1996,1997 by Christopher Heng. All rights reserved.
Copyright 1996-2012 by Christopher Heng. All rights reserved.
$Id: mktemp.h,v 1.1 2004/10/01 12:33:39 chris Exp $
Originally written for use in tofrodos, when compiled with
Watcom 10.0, which did not have either mktemp() or mkstemp().
Tofrodos can be found at
http://www.thefreecountry.com/tofrodos/index.shtml
*/
#if !defined(MKTEMP_H_INCLUDED)
......@@ -16,7 +19,7 @@ extern "C" {
#define MKTEMP_TEMPLATE "XXXXXX"
/* functions declarations */
extern char * mktemp ( char * templ );
extern int mkstemp ( char * templ );
#ifdef __cplusplus
}
......
# Makefile for use with Borland C/C++ 5.5
# Copyright (c) 1997-2005 by Christopher Heng. All rights reserved.
# $Id: makefile.bc,v 1.3 2005/03/15 14:53:56 chris Exp $
# To use this makefile, run it as follows:
# make -f makefile.bc
# This generates a Win32 console application. To generate a DOS
# 16 bit executable, see the SYSTEM macro below.
# NOTE: You *must* at minimum set the BCDIR macro as described
# below unless you happened to install your Borland C++ in E:\BC45 like
# I did!
# You may control the behaviour of this makefile with the following
# macros:
# SYSTEM Set to win32 for a Win32 console application (default)
# or dos for a DOS 16 bit executable.
# Eg,
# make SYSTEM=dos -f makefile.bc
# BCDIR Set this to point to the root directory of your compiler.
# For example, if you installed BC++ to C:\BC45, set this
# to that directory, as follows:
# make SYSTEM=dos BCDIR=C:\BC45
# Defaults to E:\BC45.
# Note that 16 bit compilation is not possible for the free Borland C++ 5.5
# compiler. Nor have I tested the 16 bit compilation for this version of
# tofrodos.
# If you really have a non-standard directory structure for your BC++
# files, you may need to manually set the following.
# INCLUDE Set this to point to the directory where your compiler
# default include files are. Defaults to $(BCDIR)\INCLUDE.
# LIB Set this to point to the directory where your compiler
# default libraries are. Defaults to $(BCDIR)\LIB.
# WILDOBJ Set this to point to where your Borland WILDARGS.OBJ is
# placed. Defaults to $(LIB)\wildargs.obj.
.AUTODEPEND
# these have to come first - the other macros depend on it
!ifndef SYSTEM
SYSTEM = win32
!endif
!ifndef BCDIR
BCDIR = C:\Borland\BCC55
!endif
# the following depend on BCDIR being set above
!ifndef INCLUDE
INCLUDE = $(BCDIR)\INCLUDE
!endif
!ifndef LIB
LIB = $(BCDIR)\LIB
!endif
# the following depend on $(LIB) being set
!ifndef WILDOBJ
!if $(SYSTEM) == win32
WILDOBJ = $(LIB)\wildargs.obj
!else
WILDOBJ = $(LIB)\16BIT\wildargs.obj
!endif
!endif
# flags that are dependent on the system we are targetting
!if $(SYSTEM) == win32
SYSCC = bcc32
SYSCFLAGS = -tWC -WC
SYSLFLAGS = -tWC -WC
!else
SYSCC = bcc
SYSCFLAGS = -ms
SYSLFLAGS = -ms
!endif
# programs and their flags
CC = $(SYSCC)
CFLAGS = -c -Ilib -I$(INCLUDE) -Ox -Oa $(SYSCFLAGS)
LFLAGS = -L$(LIB) $(SYSLFLAGS)
# filenames
CONFIGFILE = bccfg.cfg
LINKCFGFILE = bcclnk.cfg
MAKEFILE = makefile.bc
OBJS = emsg.obj init.obj tofrodos.obj utility.obj lib\getopt.obj
# user visible targets
all: todos.exe
copy todos.exe fromdos.exe
clean:
deltree /y *.exe *.obj *.cfg
# real targets
$(CONFIGFILE): $(MAKEFILE)
echo $(CFLAGS) > $(CONFIGFILE)
$(LINKCFGFILE): $(MAKEFILE)
echo $(LFLAGS) > $(LINKCFGFILE)
todos.exe: $(LINKCFGFILE) $(OBJS)
$(CC) -e$* +$(LINKCFGFILE) $(WILDOBJ) $(OBJS)
init.obj: $(CONFIGFILE) init.c
$(CC) +$(CONFIGFILE) -o$@ init.c
emsg.obj: $(CONFIGFILE) emsg.c
$(CC) +$(CONFIGFILE) -o$@ emsg.c
tofrodos.obj: $(CONFIGFILE) tofrodos.c
$(CC) +$(CONFIGFILE) -o$@ tofrodos.c
utility.obj: $(CONFIGFILE) utility.c
$(CC) +$(CONFIGFILE) -o$@ utility.c
lib\getopt.obj: $(CONFIGFILE) lib\getopt.c
$(CC) +$(CONFIGFILE) -o$@ lib\getopt.c
# makefile.dj2 Makefile for building with DJGPP on MSDOS.
# Copyright (c) 1997 by Christopher Heng. All rights reserved.
# $Id: makefile.dj2,v 1.2 2005/03/06 05:40:49 chris Exp $
# This makefile requires the GNU make to work (we use the GNU extensions).
# Define the following if you need
#
# DEBUG to add debugging information, eg "make DEBUG=1 all"
ifdef DEBUG
CDEBUG = -g
LDEBUG = -g
else
CDEBUG = -O2
LDEBUG = -s
endif
# programs
CC = gcc
CD = cd
LD = gcc
MAKE = make
RM = deltree /y
<