# makefile. - shar for MS-DOS
# Copyright (C) 1990 by Thorsten Ohl, ohl@gnu.ai.mit.edu
#
# $Header: e:/gnu/shar/RCS/makefile 3.49.0.2 90/09/25 22:03:16 tho Exp $

BINDIR	= c:/bin
VPATH	= d:/usr/lib;d:/usr/include

VERSION	= 3.49
INSTALL = cp -v
DISK	= b
ZIPFILE = shar

# Can also use -DUSE_EMS
SWAPOPT	= -DUSE_XMS

MODEL	= S
CFLAGS	= -Ox -A$(MODEL) -W4 -Za -DSMART_SHELL -DUSE_GNU_GETOPT
LDFLAGS	= /e/st:0x4000/noe setargv

# We'd better use the swaplib, since Microsoft's spawn () clobbers
# some binary files ...
LOADLIBES = gnulib_$(MODEL) swaplib$(MODEL)

CMDS	= shar.exe unshar.exe
SRCS	= uushar.c unshar.c shar.c
DOSSRCS	= pipes.c

RCSFILES= $(SRCS) $(DOSSRCS) makefile
MISC	= make.inc docs/readme docs/shar.1 docs/unshar.1 RCS/who@where.c

.PHONY: all
all: $(CMDS)

.PHONY: install
install: $(CMDS)
	$(INSTALL) $(CMDS) $(BINDIR)

shar.exe: uushar.obj
shar.exe unshar.exe: pipes.obj swap.obj _cwild.obj

swap.obj: swap.c
	$(CC) -Od -A$(MODEL) -W4 -DSMART_SHELL $(SWAPOPT) -c $<

tags: $(SRCS)
	etags $^

.PHONY: clean veryclean
clean:
	rm -f *.obj *.tar patches

veryclean:
	rm -f *.exe errs tags *.shar
	rcsclean *.c makefile

include make.inc

.PHONY: dist shar
dist: shar tar

tar: shar.tar
shar: shar.01

shar.tar: makefile make.inc patches $(DOSSRCS) $(CMDS)

shar.01: makefile make.inc patches $(DOSSRCS) $(CMDS)
	shar -Cb16 -m -anshar -L64 -o$(basename $@) $^

patches: $(SRCS)
	rcsdiff -c -r$(VERSION) $^ > $@

