1########################################################################
2# This program is Copyright (C) 1986-1996 by Jonathan Payne.  JOVE is  #
3# provided to you without charge, and with no warranty.  You may give  #
4# away copies of JOVE, including sources, provided that this notice is #
5# included in all the files.                                           #
6########################################################################
7
8# Makefile for Microsoft C version 8.0 (Visual C)
9# should also work with earlier versions
10#
11# - supported targets:
12#   + jjove.exe (build JOVE, but don't install it)
13#   + jovedosx.zoo (build executable JOVE kit for DOS)
14#   + jovedosx.zip (build executable JOVE kit for DOS)
15#   + jovew32x.zoo (build executable JOVE kit for Win32)
16#   + jovew32x.zip (build executable JOVE kit for Win32)
17#   + clean
18#
19# - to install, do the following:
20#   + copy jjove.exe where you wish
21#   + copy doc/cmds.doc to <SHAREDIR>/cmds.doc
22#   + optional: copy some jove rc (none supplied) file to <SHAREDIR>/jove.rc
23
24# Options (specify on MAKE command line with -D)
25# DEBUG=1 : enable debugging, disable optimizations
26# ARCH=0|2|3 : compile for 086/286/386 (-G option). Still 16-bit though.
27
28!if "$(DEBUG)" != ""
29DEB = -Gs -Od -Zi -DDEBUG
30!else
31DEB = -Ox -D_NDEBUG
32DEBLDFLAGS=
33!endif
34
35!IF "$(WIN32)" != ""
36SYSCFLAGS =	-DWIN32
37SYSLDFLAGS	=	/SUBSYSTEM:Console
38SYSOBJS		=	win32.obj
39LIBS		= /DEFAULTLIB:USER32 /DEFAULTLIB:KERNEL32 /DEFAULTLIB:COMDLG32
40OS	=	W32
41!if "$(DEBUG)" != ""
42DEBLDFLAGS= /DEBUG
43!else
44DEBLDFLAGS=
45!endif
46
47!ELSE # Not WIN32 - 16-bit DOS
48
49!IF "$(ARCH)" == ""
50ARCH	=	0		# Default to 8086
51!ENDIF
52
53OS	=	DOS
54MEM = L				# M for medium or L for large
55
56SYSCFLAGS = -A$(MEM) -J -Zp -G$(ARCH)
57SYSLDFLAGS	=	/PACKC/NOE/NOI/MAP/E/STACK:0x2000
58SYSOBJS		=	msgetch.obj ibmpcdos.obj
59!if "$(DEBUG)" != ""
60DEBLDFLAGS=/CO/F/B
61!endif
62!ENDIF # WIN32
63
64!IF "$(BROWSE)" != ""
65BROWSE_FLG = -FR
66BROWSE_TGT = jjove.bsc
67!ENDIF
68
69CFLAGS = $(SYSCFLAGS) $(BROWSE_FLG) -nologo $(DEB)
70
71#
72# linker flags: for debugging use /NOE/NOI/F/B/PAC/CO/STACK:0x2000
73#
74
75LDFLAGS = $(SYSLDFLAGS) $(DEBLDFLAGS)
76#
77# set VPATH as below if you have sources in SRC
78#
79SRC = .
80# VPATH = .;..	# should read .;$(SRC) - but doesn't work
81
82# Other utilities used in build - defined here so they can be overridden
83# Used to unpack binary sources. May not be needed if unpacked
84# aready on a Unix archive.
85UUDECODE	=	uudecode
86# Used to generate archives for redistributing JOVE executables and docs.
87ZOO			=	zoo
88ZIP			=	pkzip
89
90TMPDIR = c:/tmp
91RECDIR = c:/tmp
92LIBDIR = c:/jove
93SHAREDIR = $(LIBDIR)
94# BINDIR = c:/jove
95DFLTSHELL = command
96
97OBJECTS = keys.obj commands.obj abbrev.obj ask.obj buf.obj c.obj \
98	case.obj jctype.obj delete.obj extend.obj argcount.obj \
99	insert.obj io.obj jove.obj macros.obj marks.obj misc.obj mouse.obj move.obj \
100	paragraph.obj proc.obj re.obj reapp.obj scandir.obj \
101	list.obj keymaps.obj util.obj vars.obj wind.obj \
102	fmt.obj disp.obj term.obj fp.obj screen.obj \
103	$(SYSOBJS)
104
105HEADERS = abbrev.h argcount.h ask.h buf.h c.h case.h chars.h commands.h \
106	jctype.h dataobj.h delete.h disp.h extend.h externs.h \
107	fmt.h fp.h insert.h io.h iproc.h jove.h \
108	keymaps.h list.h mac.h macros.h marks.h \
109	misc.h mouse.h move.h paragraph.h proc.h \
110	re.h reapp.h rec.h scandir.h screen.h \
111	sysdep.h sysprocs.h temp.h term.h ttystate.h \
112	tune.h util.h vars.h version.h wind.h
113
114!IF "$(WIN32)" != ""
115RESOURCE	=	jjove.res
116!ENDIF
117
118all: jjove.exe $(BROWSE_TGT)
119
120jjove.exe:	$(OBJECTS) $(HEADERS) $(RESOURCE)
121!IF "$(WIN32)" != ""
122	link  /OUT:jjove.exe /MAP $(LIBS) @<<jove.lnk $(LDFLAGS)
123$(OBJECTS: = ^
124)
125setargv.obj
126$(RESOURCE)
127<<KEEP
128!ELSE
129	link  @<<jove.lnk $(LDFLAGS)
130$(OBJECTS: = +^
131) +
132setargv.obj
133jjove.exe
134
135<<KEEP
136!ENDIF
137
138# Jove users note: don't confuse jjove.rc with jove.rc, which
139# is the Jove setup script.
140jjove.res:	jjove.rc jjove.ico resource.h
141	$(RC) $(RCDEFINES) -r jjove.rc
142
143jjove.bsc: $(OBJECTS:.obj=.sbr)
144	bscmake @<<
145/o $@ $(OBJECTS:.obj=.sbr)
146<<
147
148jove.obj:	paths.h
149vars.obj:	vars.tab
150commands.obj:	commands.tab
151setmaps.obj:	vars.tab commands.tab
152
153# Compensate for 8.3 naming (or lack thereof)
154!IF "$(WIN32)" == ""
155paragraph.h:
156	if exist paragr~1.h rename paragr~1.h paragraph.h
157paragraph.c:
158	if exist paragr~1.c rename paragr~1.c paragraph.c
159!ELSE
160paragraph.h:
161	if exist paragrap.h rename paragrap.h paragraph.h
162paragraph.c:
163	if exist paragrap.c rename paragrap.c paragraph.c
164!ENDIF
165
166jove$(OS)x.zoo:	paths.h jjove.exe
167	-del jove$(OS)x.zoo
168	-del jove.exe
169	rename jjove.exe jove.exe
170	$(ZOO) -add jove$(OS)x.zoo jove.exe doc\cmds.doc doc\jove.man doc\jove.doc paths.h README.$(OS)
171
172jove$(OS)x.zip:	paths.h jjove.exe
173	-del jove$(OS)x.zip
174	-del jove.exe
175	rename jjove.exe jove.exe
176	$(ZIP) -aP jove$(OS)x.zip jove.exe doc\cmds.doc doc\jove.man doc\jove.doc paths.h README.$(OS)
177
178paths.h: makefile.msc
179	@echo Making <<paths.h
180/* Changes should be made in Makefile, not to this file! */
181
182#define TMPDIR "$(TMPDIR)"
183#define RECDIR "$(RECDIR)"
184#define LIBDIR "$(LIBDIR)"
185#define SHAREDIR "$(SHAREDIR)"
186#define DFLTSHELL "$(DFLTSHELL)"
187<<KEEP
188
189# The Jove icon target should be part of the distributed ZOO file, but
190# if not this rule will build it.
191jjove.ico:	jjoveico.uue
192	$(UUDECODE) $**
193
194!IFNDEF WIN32
195ibmpcdos.obj:	ibmpcdos.c jove.h
196	$(CC) $(CFLAGS) -I$(SRC) -NTscreen_text -c ibmpcdos.c
197!ENDIF
198
199$(OBJECTS): $(HEADERS)
200
201setmaps.exe:	setmaps.obj
202	cl /F 6000 setmaps.obj
203
204setmaps.obj:	commands.tab vars.tab keys.txt setmaps.c
205
206keys.c:	setmaps.exe keys.txt
207	setmaps < keys.txt > keys.c
208
209keys.obj:	keys.c jove.h
210	$(CC) $(CFLAGS) -I$(SRC) -c keys.c
211
212clean:
213	-rm *.obj setmaps.exe keys.c *.bak *.map *.pdb *.vcp jove.lnk
214