File: makefile.wnt

package info (click to toggle)
vile 9.6m-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,196 kB
  • ctags: 8,459
  • sloc: ansic: 90,876; lex: 9,514; sh: 3,223; cpp: 3,137; perl: 2,928; makefile: 785; awk: 276
file content (419 lines) | stat: -rw-r--r-- 11,833 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
#
# makefile for vile on WIN32 using Microsoft Visual C++
#
# $Header: /usr/build/vile/vile/RCS/makefile.wnt,v 1.98 2007/10/14 21:09:35 tom Exp $
#
#
!include <ntwin32.mak>

###############################################################################
# These are the symbols that you may wish to set on the command line (do not set
# nmake symbols directly, since that disallows updating those within the makefile,
# e.g., see how $(MY_CCOPT) is built up):
#	CFG - primary configuration (console vs windows)
#	DBG - nonempty for debugging
#	FLT - nonempty for built-in filters
#	LEX - name of flex/lex program, if any (needed to make most filters).
#	OPT - secondary configuration (extra features)
#	ICON - winvile's icon
#	TRACE - nonempty to suppress tracing when building a debug-executable.
#	PROGNAME - vile/winvile $progname value
#	VILEDEFS - other options, as needed
###############################################################################

# you can override the icon to suit your taste (e.g,. vile, kitchen-sink,
# or V-eye pumpkin).

ICON	= vile

!IF "$(CFG)" == ""
CFG=vile
!MESSAGE No configuration (CFG) specified.  Defaulting to vile (console)
!ENDIF

!IF ("$(CFG)" != "vile" && "$(CFG)" != "winvile"  &&                     \
     "$(CFG)" != "vile-with-perl" && "$(CFG)" != "winvile-with-perl") || \
    ("$(OPT)" != "" && "$(OPT)" != "ole-auto") ||                        \
        ("$(OPT)" == "ole-auto" &&                                       \
        ("$(CFG)" == "vile" || "$(CFG)" == "vile-with-perl"))
!MESSAGE Invalid configuration specified!
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE on this makefile
!MESSAGE by defining a CFG and/or OPT macro on the command line.  Possible
!MESSAGE configuration choices are:
!MESSAGE
!MESSAGE vile              - console
!MESSAGE vile-with-perl    - console and embedded perl
!MESSAGE winvile           - gui
!MESSAGE winvile-with-perl - gui and embedded perl
!MESSAGE
!MESSAGE The 'with-perl' configurations have two preconditions which must be
!MESSAGE met prior to initiating the build.  Refer to the file "mkprlenv.wnt"
!MESSAGE for more details.
!MESSAGE
!MESSAGE The only supported OPT value is:
!MESSAGE
!MESSAGE ole-auto          - add basic ole automation to winvile
!MESSAGE
!MESSAGE Examples:
!MESSAGE
!MESSAGE /* build console editor */
!MESSAGE nmake -f makefile.wnt
!MESSAGE
!MESSAGE /* build gui editor with embedded perl and basic ole automation */
!MESSAGE nmake -f makefile.wnt CFG=winvile-with-perl OPT=ole-auto
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF

# $(cflags), defined via ntwin32.mak, is a critical compiler resource.
# This variable controls what OS features, such as a mouse wheel, can be
# accessed via include files.
CFLWIN32     = $(cflags:-W3=)      # strip out warning option
CFLWIN32     = $(CFLWIN32:-c=)     # strip out -c flag

# remove the "#" to get debugging info (and a larger executable)
CC_DEBUG     = -W4 #$(cdebug)
LD_DEBUG     = #$(ldebug)

# Other vars
CON_LDFLAGS  = -nologo -pdb:none
DEVNULL      = nul
PERLCFG      = $(DEVNULL)
THE_PERLCFG  = perl_env.inc

!IF EXIST("$(THE_PERLCFG)")
!INCLUDE "$(THE_PERLCFG)"
!ENDIF

# debug/release configurations
!IF  "$(DBG)" != ""
MY_CCOPT = $(cdebug) -DVILE_ERROR_ABORT
MY_LDOPT = $(ldebug)
!IF "$(TRACE)" == ""
DBGOBJS  = trace.obj
MY_CCOPT = $(MY_CCOPT) -DOPT_TRACE
!ENDIF
!else
MY_LDOPT = -pdb:none
!endif

# options common to all configurations
MY_CCOPT = $(MY_CCOPT) -DOPT_LOCALE -I.

!IF  "$(VILEDEFS)" != ""
MY_CCOPT = $(MY_CCOPT) $(VILEDEFS)
!endif

!IF  "$(CFG)" == "vile" || "$(CFG)" == "vile-with-perl"
DISP_DEF = -DDISP_NTCONS
TARGET   = vile
CFLAGS   = $(cvarsmt) $(CC_DEBUG) -nologo -DWIN32_LEAN_AND_MEAN -G4 \
	   -Dscrn_chosen $(DISP_DEF) $(PERLOPTS) $(MY_CCOPT) $(CFLWIN32)
LDFLAGS  = -nologo $(MY_LDOPT)
SCREEN   = ntconio
LIBS     = $(LD_DEBUG) $(conlflags) $(conlibsmt) user32.lib comdlg32.lib \
           ole32.lib shell32.lib $(VILE_PERL_LIB)
!endif

!IF  "$(CFG)" == "winvile" || "$(CFG)" == "winvile-with-perl"
DISP_DEF = -DDISP_NTWIN
TARGET   = winvile
CFLAGS   = $(cvarsmt) $(CC_DEBUG) -nologo -DWIN32_LEAN_AND_MEAN -G4 \
	   -Dscrn_chosen $(DISP_DEF) $(PERLOPTS) $(MY_CCOPT) $(CFLWIN32)
LDFLAGS  = -nologo /subsystem:windows /incremental:no $(MY_LDOPT)
SCREEN   = ntwinio
LIBS     = $(LD_DEBUG) $(guilflags) $(guilibsmt) ole32.lib shell32.lib \
           $(VILE_PERL_LIB) $(OLELIBS)
EXTRAOBJ = makeargv.obj
EXTRA    = winvile.res
!endif

!IF "$(PROGNAME)" != "" && "$(PROGNAME)" != "$(TARGET)"
!MESSAGE Overriding target name to $(PROGNAME)
TARGET   = $(PROGNAME)
CFLAGS   = $(CFLAGS) -DPROGRAM_NAME=\"$(PROGNAME)\"
!endif

MAPFILE  = $(TARGET).map
ZIPFILE  = $(TARGET).zip
EXEFILE  = $(TARGET).exe

!IF "$(OPT)" == "ole-auto"
CFLAGS   = $(CFLAGS) -DVILE_OLE
OLEOBJS  = w32ole.obj w32reg.obj w32ole.res
OLESRCS  = w32ole.cpp w32reg.c
WRAPUTIL = wvwrap.exe
OLELIBS  = uuid.lib oleaut32.lib comsupp.lib
EXTRA    = 
!endif

!IF "$(CFG)" == "winvile-with-perl" || "$(CFG)" == "vile-with-perl"
#
# CPAN's most recent X86 binary perl distribution, dated 12-Nov-97, does
# not export perl's record separator symbol ($/).  Consequently, the
# preprocessor macro HAVE_BROKEN_PERL_RS must be defined to permit
# successful linking of perl-embedded versions of the editor.  When this
# macro is defined, READLINE performance in perl.xs may be adversely
# affected.  Comment out the makefile macro "PERLFIX" if your version of
# perl properly exports $/ .
#
PERLFIX  = -DHAVE_BROKEN_PERL_RS
PERLOPTS = -DOPT_PERL=1 -I$(VILE_PERL_INC) $(PERLFIX)
PERLOBJS = api.obj perl.obj watch.obj
PERLSRCS = api.c perl.c watch.c
PERLCFG  = $(THE_PERLCFG)
#
# The following perl scripts, stored in the subdirectory .\perl, are
# known to work under win32:
#
PERL_SCRIPTS = \
	perl/Breadcrumbs.pm \
	perl/CaptHook.pm \
	perl/Glob2re.pm \
	perl/Vile/Manual.pm \
	perl/Vile/exporter.pm \
	perl/Visit.pm \
	perl/directory.pm \
	perl/dirlist.pm \
	perl/hgrep.pm \
	perl/search.pm
!ENDIF

MYLIBS	=

# these headers are built by the mktbls program from the information in cmdtbl
# and in modetbl
MYHDRS	= \
	nebind.h \
	neexec.h \
	nefkeys.h \
	nefsms.h \
	nefunc.h \
	nemode.h \
	nename.h \
	neproto.h \
	nevars.h

FLTLIB	= filters\builtflt.lib

!IF  "$(FLT)" != ""
EXTRA	= $(EXTRA) builtflt.obj
# MYHDRS	= $(MYHDRS) builtflt.h
MYLIBS	= $(MYLIBS) $(FLTLIB)
CFLAGS	= $(CFLAGS) -DOPT_FILTER -Ifilters -I.
!IF  "$(LEX)" != ""
CFLAGS	= $(CFLAGS) -DOPT_LEX_FILTER
!endif
!endif

# these are normal editable headers
HDRS = estruct.h edef.h proto.h dirstuff.h

SRC = 	main.c $(SCREEN).c \
	basic.c bind.c blist.c btree.c buffer.c charsets.c \
	csrch.c display.c eightbit.c eval.c exec.c externs.c \
	fences.c file.c filec.c \
	fileio.c finderr.c glob.c globals.c history.c \
	input.c insert.c itbuff.c isearch.c \
	line.c modes.c msgs.c nullterm.c oneliner.c opers.c \
	path.c random.c regexp.c \
	region.c search.c select.c spawn.c statevar.c \
	tags.c tbuff.c termio.c ucrypt.c undo.c \
	version.c window.c word.c wordmov.c map.c \
	w32cbrd.c w32cmd.c w32misc.c w32oo.cpp w32pipe.c \
	wcwidth.c $(PERLSRCS) \
	$(OLESRCS)

OBJ = 	main.obj $(SCREEN).obj \
	basic.obj bind.obj blist.obj btree.obj buffer.obj charsets.obj \
	csrch.obj display.obj eightbit.obj eval.obj exec.obj externs.obj \
	fences.obj file.obj filec.obj \
	fileio.obj finderr.obj glob.obj globals.obj history.obj \
	input.obj insert.obj itbuff.obj isearch.obj \
	line.obj modes.obj msgs.obj nullterm.obj oneliner.obj opers.obj \
	path.obj random.obj regexp.obj \
	region.obj search.obj select.obj spawn.obj statevar.obj \
	tags.obj tbuff.obj termio.obj ucrypt.obj undo.obj \
	version.obj window.obj word.obj wordmov.obj map.obj \
	w32cbrd.obj w32cmd.obj w32misc.obj w32oo.obj w32pipe.obj \
	wcwidth.obj $(PERLOBJS) \
	$(OLEOBJS) $(DBGOBJS) $(EXTRAOBJ) $(EXTRA)

.c.obj:
	$(cc) $(CFLAGS) -c $< -Fo$@

.cpp.obj:
	$(cc) $(CFLAGS) -c $< -Fo$@

all :: $(PERLCFG) $(EXEFILE) $(WRAPUTIL)

sources ::	$(MYHDRS)

$(EXEFILE) : 	$(MYHDRS) $(OBJ) $(MYLIBS)
	$(link) $(LDFLAGS) $(OBJ) $(MYLIBS) $(LIBS) -out:$(EXEFILE) -map:$(MAPFILE)

winvile.res :	winvile.rc winvile.h
	$(RC) -DVILE_ICON="$(ICON).ico" -Iicons winvile.rc

# collect some perl environment info
!if "$(PERLCFG)" != "$(DEVNULL)"
!if !exist("$(PERLCFG)")
$(PERLCFG): $(PERL_SCRIPTS) mkprlenv.wnt
	echo making PERLCFG $(PERLCFG)
!INCLUDE "mkprlenv.wnt"
	echo ...made PERLCFG $(PERLCFG)
!endif
!endif

$(OBJ): estruct.h edef.h proto.h $(MYHDRS)
builtflt.obj : builtflt.h

MAKE_FLT = FLT=$(FLT) LEX="$(LEX)" DBG="$(DBG)" SCREEN="$(SCREEN)" -$(MAKEFLAGS)

builtflt.h :
	cd filters
	$(MAKE) -f makefile.wnt genmake.exe $(MAKE_FLT)
	mk-0th.bat genmake.mak ..\$@
	cd ..

$(FLTLIB) : $(MYHDRS)
	cd filters
	$(MAKE) -f makefile.wnt all $(MAKE_FLT)
	cd ..

nebind.h \
nefkeys.h \
neexec.h \
nefunc.h \
neproto.h \
nename.h :	cmdtbl mktbls.exe
	mktbls.exe cmdtbl

nefsms.h \
nevars.h \
nemode.h:	modetbl mktbls.exe
	mktbls.exe modetbl

perl.c: perl.xs ptypemap
	perl $(VILE_PERL_UTILS)\xsubpp -typemap $(VILE_PERL_UTILS)\typemap \
		-typemap ptypemap perl.xs > $@

vile-perl-api.pod: perl.xs
	perl -lne "print if s/^\s{1,2}#\s{0,1}//" perl.xs > $@

vile-perl-api.doc: vile-perl-api.pod
	perl -e "use Pod::Text; pod2text(\"$?\");" > $@

wvwrap.exe: wvwrap.obj makeargv.obj
 	$(link) $(LDFLAGS) wvwrap.obj makeargv.obj $(LIBS) -out:$(@)

mktbls.exe:  mktbls.c
	$(cc) $(CFLAGS) mktbls.c -Fomktbls -link $(CON_LDFLAGS)

w32ole.res: w32ole.rc winvile.tlb
	$(RC) $(DISP_DEF) -DVILE_ICON="$(ICON).ico" -Iicons w32ole.rc

winviletlb.h winvile.tlb: winvile.odl
	midl -h winviletlb.h -tlb winvile.tlb winvile.odl

test_btree.exe :	btree.c
	$(CC) -Fo$* -DDEBUG_BTREE $(CPPFLAGS) $(CFLAGS) btree.c $(LDFLAGS)

test_regexp.exe :	regexp.c
	$(CC) -Fo$* -DDEBUG_REGEXP $(CPPFLAGS) $(CFLAGS) regexp.c $(LDFLAGS)

TEST_IO_OBJS	= \
	$(SCREEN).obj \
	nullterm.obj \
	test_io.obj

test_io.exe :		$(TEST_IO_OBJS)
	$(link) $(TEST_IO_OBJS) $(LDFLAGS) $(LIBS) -out:$(@)

clean ::
	-del *.bak
	-del *.exe
	-del *.ilk
	-del *.map
	-del *.pdb
	-del *.obj
	-del ne*.h
	-del $(THE_PERLCFG)
	-del builtflt.h
	-del perl.c
	-del winviletlb.h
	-del winvile_i.c
	-del *.tlb
	-del *.res

dist : $(EXEFILE)
	- del $(ZIPFILE)
	echo "$(TARGET)", vi-like-emacs for win32 >zipnote.txt
	zip $(TARGET).zip readme.pc readme $(EXEFILE) $(MAPFILE) vile.hlp
	zip -z $(ZIPFILE) <zipnote.txt
	- del zipnote.txt
	cd macros
	zip ..\$(ZIPFILE) *.rc
	cd ..\filters
	$(MAKE) -f makefile.wnt $@ $(MAKE_FLT)
	cd ..

all \
clean ::
	cd filters
	$(MAKE) -f makefile.wnt $@ $(MAKE_FLT)
	cd ..

SCRIPTS	= \
	filters\filters.rc \
	filters\spell.rc \
	macros\dates.rc \
	macros\digraphs.rc \
	macros\gnugpg.rc \
	macros\loaderrs.rc \
	macros\manpage.rc \
	macros\modes.rc \
	macros\palettes.rc \
	macros\pictmode.rc \
	macros\search.rc \
	macros\shifts.rc \
	macros\showeach.rc \
	macros\vileinit.rc \
	macros\vileperl.rc \
	macros\which.rc

!if "$(VILE_STARTUP_PATH)" == ""
all ::
	@ echo Sorry, you have not set VILE_STARTUP_PATH
!else if !exist("$(VILE_STARTUP_PATH)")
all :: $(SCRIPTS) vile.hlp
	@echo Sorry, these are installed only if VILE_STARTUP_PATH is a single directory
	!@echo "      $(**F)"
!else
all :: $(SCRIPTS) vile.hlp
	echo installing $(SCRIPTS) in $(VILE_STARTUP_PATH)
	- !copy $** "$(VILE_STARTUP_PATH)"\$(**F)
!endif

api.obj :	api.h
bind.obj :	btree.h
blist.obj :	blist.h
btree.obj :	btree.h
display.obj :	pscreen.h
filec.obj :	dirstuff.h
glob.obj :	dirstuff.h
main.obj :	chgdfunc.h
modes.obj :	chgdfunc.h
ntwinio.obj :	winvile.h pscreen.h patchlev.h makeargv.h
path.obj :	dirstuff.h
perl.obj :	api.h
random.obj :	dirstuff.h
statevar.obj :	patchlev.h
tags.obj :	btree.h
version.obj :	patchlev.h
w32cmd.obj :	winvile.h
w32ole.obj :	w32ole.h winviletlb.h w32reg.h
w32oo.obj :	dirstuff.h
w32reg.obj :	w32reg.h
wvwrap.obj :	w32reg.h w32ole.h winviletlb.h makeargv.h