# Makefile for info (GNUish MS-DOS)
# Copyright (C) 1990 Free Software Foundation, Inc.
# Thorsten Ohl <td12@ddagsi3.bitnet>, 1990

# 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 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA.

# $Header: e:/gnu/info/RCS/makefile 0.1.0.13 90/10/26 22:04:58 tho Exp $

# This makefile assumes that you have built the gnulib for the compact
# memory model and that `link' knows how to find it.

# General configuration section

BUILD	= debug
MODEL	= C
MSC	= 600

# Remove these if you keep the sources in one file
SPLIT_INFO = info.d
SPLIT_MAKEINFO = makeinfo.d makeinfo.e

# Where the executable and the info files live
BINDIR	= c:/bin
DEFAULT_INFOPATH = .;c:/emacs/info

INSTALL = cp -v
DISK	= b
ZIPFILE = info

# -DUSE_ASSEMBLER if your compiler can support inline assembler
# for the bios calls
# -DUSE_ANSI if you want to use your ANSI terminal driver (slow)

ifeq ($(MSC),600)
# MSC 6.0 knows about inline assembler and can be made even more verbose
VIDEO	= -DUSE_ASSEMBLER
WARNINGS= 4
else
WARNINGS= 3
endif

ifeq ($(BUILD),debug)
CFLAGS	= -Od -Zi -A$(MODEL) -DSYSV -W$(WARNINGS) $(VIDEO)
LDFLAGS = /noi/st:0x8000/co
else
# Leave the stack probes in the code ...
CFLAGS	= -Ox -Ge -A$(MODEL) -DSYSV -W$(WARNINGS) $(VIDEO)
LDFLAGS = /noi/st:0x8000/e
endif

LOADLIBES = gnulib_$(MODEL)

INFO_FLAGS = -DDEFAULT_INFOPATH=\\"$(DEFAULT_INFOPATH)\\"
MAKEINFO_FLAGS = -DMAKEINFO_MAJOR=1 -DMAKEINFO_MINOR=0

# Files

SRCS	= info.c $(SPLIT_INFO) makeinfo.c $(SPLIT_MAKEINFO) pc_term.c
OBJS	= info.obj makeinfo.obj pc_term.obj
INCS	= pc_term.h

CMDS	= info.exe makeinfo.exe

DOCS	= default-nodes.texinfo test-suite.texinfo makeinfo.texinfo

RCSFILES= $(SRCS) $(INCS) makefile
MISC	= ChangeLog readme readme.gmd todo make.inc 3diff offset tar_-tv \
	  $(DOCS)


# Targets

.PHONY: all install dist clean veryclean
all:	$(CMDS)

info.exe: info.obj pc_term.obj

# This will be the default in the next make release:
%.exe: %.obj
	$(LINK) $(LDFLAGS) $^,$@,,$(LOADLIBES) $(LDLIBS),

ifeq ($(MSC),600)
# Work around MSC 6.0 commandline bug...
CL:=$(CFLAGS)
info.obj: info.c $(SPLIT_INFO)
	CL -c $(INFO_FLAGS) $<
else
info.obj: info.c $(SPLIT_INFO)
	$(CC) -c $(CFLAGS) $(INFO_FLAGS) $<
endif

makeinfo.obj: makeinfo.c $(SPLIT_MAKEINFO)
	$(CC) -c $(CFLAGS) $(MAKEINFO_FLAGS) $<

info.obj pc_term.obj: pc_term.h

# Maintenance

include make.inc

install: $(CMDS)
	$(INSTALL) $^ $(BINDIR)

clean:
	$(RM) $(wildcard *.obj)

veryclean: clean
	$(RM) *.exe errs tags info.[0-9][0-9]
	rcsclean $(SRCS) $(INCS) makefile

tags: $(SRCS)
	etags $^

PACKETSIZE = 55
dist: info.01

# When this target is remade, we should have the 'big'
# info.c and makeinfo.c files.
info.01: copying readme readme.gmd makefile make.inc Changelog tar_-tv \
	 $(DOCS) $(SRCS) $(INCS) $(CMDS)
	shar -Cb16 -F -an'GNUish MS-DOS (make)info' \
		-L$(PACKETSIZE) -o $(basename $@) $^


