# CPDIST Makefile for the MS-DOS 386/G++ GNU C/C++ Compiler (DJGPP)
# We expect DJGPP version 1.02 (is there any other ?!)
#
# (c)Copyright 1992-93 by Tobias Ferber.
#
# This file is part of CPDIST.
#
# CPDIST 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 1 of the License, or
# (at your option) any later version.
#
# CPDIST 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 CPDIST; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

CC=gcc

# -DNO_GETKEY   use gets() instead of getkey()
# -DNO_PERROR   don't use perror()

# Why the hell don't they define __MSDOS__ but unix ?
CFLAGS= -O -D__MSDOS__ -Uunix

# The Ža.out' files from DJGPP are not executable on MS-DOS machines.
# They need an extender (e.g. GO32.EXE) which either must be prepended
# or run as a command with the a.out filename in it's arguments.
# Alternatively you may prepend the STUB.EXE which executes GO32 from
# your PATH.  Stub is much smaller than go32, so less disk space is used.
# Also, if you change go32, you don't have to change stub, and all the
# stub-ized programs will use the new go32 automatically.

EXTENDER=c:\devel\djgpp\bin\stub.exe

.PHONY: all

all: cpdist

cpdist: cpdist.exe

cpdist.exe: cpdist.out
	copy /b $(EXTENDER) + $< $@ > nul:
	del $<

cpdist.out: main.o args.o msg.o cpdist.o keys.o getkey.o filecopy.o
	$(CC) $(CFLAGS) -o $@ $?

main.o: main.c cpdist.h
	$(CC) $(CFLAGS) -c -o $@ $<

args.o: args.c
	$(CC) $(CFLAGS) -c -o $@ $<

msg.o: msg.c cpdist.h
	$(CC) $(CFLAGS) -c -o $@ $<

cpdist.o: cpdist.c cpdist.h
	$(CC) $(CFLAGS) -c -o $@ $<

keys.o: keys.c cpdist.h
	$(CC) $(CFLAGS) -c -o $@ $<

getkey.o: getkey.c getkey.h
	$(CC) $(CFLAGS) -c -o $@ $<

filecopy.o: filecopy.c filecopy.h
	$(CC) $(CFLAGS) -c -o $@ $<

# *** / TAGS / ***

tags:
	etags -t *.c *.h
