# dll\makefile - build fm/2 dlls, help files, string tables and resource kit # $Id$ # Copyright (c) 1993-98 M. Kimes # Copyright (c) 2002-2020 Steven H. Levine # 22 May 03 SHL Correct icon dependencies # 12 May 07 SHL Drop obsolete macros # 02 Jun 07 SHL Convert to OpenWatcom # 27 Jun 07 SHL Allow DEBUG set from command line or environment # 03 Jul 07 SHL Change DEBUG semantics to ifdef/ifndef # 04 Jul 07 SHL Pass DEBUG settings to sub-make # 04 Jul 07 SHL Add missing .AUTODEPEND # 06 Aug 07 SHL Tweak CFLAGS for DEBUG builds # 26 Aug 07 SHL Clean *.lrf # 05 Sep 07 SHL Correct USE_WRC logic # 22 Sep 07 SHL Switch to 4 byte packing (-zp4) # 03 Jan 08 SHL Prepare for final, implending switch to wrc.exe # 03 Jan 08 SHL Switch to wrc.exe default; support USE_RC from environment # 05 Jan 08 SHL Sync with .c renames # 22 Feb 08 JBS Suppress lxlite processing when DEBUG=1 # 01 Mar 08 SHL Add missing dependencies. Add WARNALL support # 05 May 08 SHL Add FORTIFY support # 26 May 08 SHL Update WARNALL to warn about more # 22 Jul 08 SHL Change from dllsyms to syms target for consistency # 06 Oct 08 SHL Add missing -dDEBUG= to CFLAGS; rework lxlite suppress logic # 25 Oct 08 SHL Rework dependencies to avoid target dependent build failures # 18 Nov 08 JBS Ticket 297: Various build improvements/corrections # 19 Nov 08 JBS Ticket 297: Removed bldlevel calls # 21 Nov 08 JBS Ticket 297: Added support for copyright.c and copyright.h # 08 Dec 08 SHL Ticket 307: Add process dump support # 10 Dec 08 SHL Ticket 26: Add exception handler and exceptq support # 14 Dec 08 SHL Drop copyright.c support - it's gone # 18 Dec 08 SHL Avoid extra fm3res.str builds # 04 Feb 09 SHL Drop mkstr and fm3*.str now that we use STRINGTABLE # 12 Jul 09 GKY Allow FM/2 to load in high memory call exehdr /hi # 30 Jul 09 SHL Avoid attempting to attach resources to fm3res.map # 13 Apr 10 SHL Drop HIMEM support # 09 Feb 11 SHL Add exceptq .xqs support # 21 Jun 11 GKY Make high memory builds the default # 01 Jul 11 SHL sort map # 04 Jul 11 GKY Make xqs files an explicit target so they will be rebuild if lost somehow. # 04 Jul 11 GKY Add eFTE backup files (*~) to clean target # 13 Aug 11 GKY Build xqs and sym files as part of dll and all targets # 25 Jan 12 SHL Allow NOHIGHMEM set from enviroment # 18 Feb 14 JBS Ticket #516: Run exehdr to set high-memory only if something has changed. # 21 Feb 14 JBS Ticket #500: Set only non-resource objects in FM3RES.DLL to high memory # 24 Feb 14 JBS Ticket #500: Suspended use of high memory by commenting out the calls to exehdr # 13 Aug 15 SHL Add listutil # 25 Jan 20 SHL Add PMPRINTF support # Environment: see makefile_pre.mk and makefile_post.mk # DEBUG - debug build if defined, release build if not defined # WARNALL - add more warnings if defined, standard warnings if not defined # FORTIFY - enable FORTIFY heap checking if defined, omit FORITY support if not defined # PMPRINTF - enable PMPRINTF support, omit PMPRINTF support if not defined # USE_RC - use rc.exe if defined, use wrc.exe if not defined # NOHIGHMEM - support high memory use (i.e exehdir /highmem) # FM4_NOWARN_DSPACE - Turns off low disk space read only media warnings for use with AN main frame backup # PMPRINTF support assumes PMPRINTF.H in INCLUDE path # PMPRINTF support assumes PMPRINTF.LIB in LIB path BASE = fm3dll BASERES = fm3res BASERESDE = fm3resde .SUFFIXES: .SUFFIXES: .obj .c .res .rc .ipf CC = wcc386 LINK = wlink !ifndef USE_RC # if not defined on command line !ifdef %USE_RC # if defined in environment USE_RC = $(%USE_RC) !endif !endif !ifdef USE_RC RC = rc -n !else RC = wrc -q !endif # Keep this code in sync with makefile_pre.mk !ifdef DEBUG # if defined on wmake command line DEBUG_OPT = DEBUG=$(DEBUG) # set in case needed by sub-make !else !ifdef %DEBUG # if defined in environment DEBUG = $(%DEBUG) # use value from environment DEBUG_OPT = DEBUG=$(DEBUG) # set in case needed by sub-make !endif !endif !ifdef %WARNALL # if defined in environment WARNALL = $(%WARNALL) # use value from environment !endif !ifdef %FORTIFY # if defined in environment FORTIFY = $(%FORTIFY) # use value from environment !endif !ifdef %PMPRINTF # if defined in environment PMPRINTF = $(%PMPRINTF) # use value from environment !endif !ifdef %FM4_NOWARN_DSPACE # if defined in environment FM4_NOWARN_DSPACE = $(%FM4_NOWARN_DSPACE) # use value from environment !endif # Keep this code in sync with makefile_post.mk !ifndef NOHIGHMEM !ifdef %NOHIGHMEM NOHIGHMEM=$(%NOHIGHMEM) !endif !endif # targets for building SYM files SYMS = $(BINDIR)$(BASE).sym $(BINDIR)$(BASERES).sym $(BINDIR)$(BASERESDE).sym & $(BINDIR)$(BASE).xqs $(BINDIR)$(BASERES).xqs $(BINDIR)$(BASERESDE).xqs # Some flags are order dependent - see OpenWatcom docs # -bc console app # -bd build target is a Dynamic Link Library (DLL) # -bg gui app with WinMain entry point # -bm multithread libs # -bt=os2 target # -d1 line number debugging information # -d2 full symbolic debugging information # -d3 full debug w/unref # -hd dwarf # -j signed char # -mf flat # -of generate traceable stack frames # -olinars optimze loops, inline, e(n)able fp recip, relax (a)lias, reordering, space # -s disable stack checks # -sg generate calls to grow the stack # -st touch stack through SS first # -we treat warnings as errors # -wx max warnings # -zfp disable fs use # -zgp disable gs use # -zp4 align 4 # -zq quiet # -wx excludes these # See GenCOptions() in openwatcom\bld\cc\c\coptions.c # -wce130 possible loss of precision # -wcd=303 no reference to formal parameter # -wcd=307 obsolete non-prototype declarator # -wcd=308 unprototyped function called # -wcd=309 unprototyped function called indirectly !ifdef DEBUG CFLAGS = -bt=os2 -mf -bd -bm -hd -d2 -olirs -s -sg -j -wx -zfp -zgp -zp4 -zq -d$DEBUG_OPT CFLAGS = -bt=os2 -mf -bd -bm -hd -d2 -s -sg -j -wx -zfp -zgp -zp4 -zq -d$DEBUG_OPT OBJDIR = Debug\obj\ BINDIR = Debug\bin\ !else CFLAGS = -bt=os2 -mf -bd -bm -hd -d1 -olirs -s -sg -j -wx -zfp -zgp -zp4 -zq OBJDIR = Release\obj\ BINDIR = Release\bin\ !endif # 26 May 08 SHL Was reversed !ifdef WARNALL CFLAGS += -wce=118 -wce=130 -wce=303 -wce=307 -wce=308 -wce=309 !else CFLAGS += -we !endif !ifdef FORTIFY CFLAGS += -dFORTIFY !endif !ifdef PMPRINTF CFLAGS += -dPMPRINTF !endif !ifdef FM4_NOWARN_DSPACE CFLAGS += -dFM4_NOWARN_DSPACE !endif # for fm3res only CFLAGSR = -bt=os2 -mf -bd -bm -olirs -s -j -we -wx -zfp -zgp -zp4 -zq LFLAGS = sys os2v2_dll initinstance terminstance op quiet op verbose op cache & op caseexact op implib !ifdef DEBUG LFLAGS += debug dwarf all !endif # rc Includes can be in current director or dll subdirectory !ifdef USE_RC RCFLAGS = -r -i dll RCFLAGS2 = -x2 !else # Pass 1 flags RCFLAGS = -r -i=dll -ad # Pass 2 flags RCFLAGS2 = !endif !ifndef MAKERES .c.obj: .AUTODEPEND $(CC) -fo$*.obj $^&.c !else # !error "MAKERES mode" !endif OBJS = $(OBJDIR)arccnrs.obj $(OBJDIR)archive.obj $(OBJDIR)assoc.obj & $(OBJDIR)attribs.obj $(OBJDIR)autoview.obj $(OBJDIR)avl.obj & $(OBJDIR)avv.obj $(OBJDIR)chklist.obj $(OBJDIR)cmdline.obj & $(OBJDIR)codepage.obj $(OBJDIR)collect.obj $(OBJDIR)colors.obj & $(OBJDIR)command.obj $(OBJDIR)common.obj $(OBJDIR)comp.obj & $(OBJDIR)copyf.obj $(OBJDIR)datamin.obj $(OBJDIR)defview.obj & $(OBJDIR)delims.obj $(OBJDIR)dircnrs.obj $(OBJDIR)dirs.obj & $(OBJDIR)dirsize.obj $(OBJDIR)draglist.obj $(OBJDIR)droplist.obj & $(OBJDIR)dumputil.obj $(OBJDIR)eas.obj $(OBJDIR)errutil.obj & $(OBJDIR)excputil.obj $(OBJDIR)extract.obj $(OBJDIR)filldir.obj & $(OBJDIR)filter.obj $(OBJDIR)findrec.obj $(OBJDIR)flesh.obj & $(OBJDIR)fm2cmd.obj $(OBJDIR)fonts.obj $(OBJDIR)fortify.obj & $(OBJDIR)getnames.obj $(OBJDIR)grep.obj $(OBJDIR)grep2.obj & $(OBJDIR)i18nutil.obj $(OBJDIR)info.obj $(OBJDIR)inis.obj & $(OBJDIR)init.obj $(OBJDIR)input.obj $(OBJDIR)instant.obj & $(OBJDIR)key.obj $(OBJDIR)killproc.obj $(OBJDIR)listutil.obj & $(OBJDIR)literal.obj $(OBJDIR)loadbmp.obj $(OBJDIR)mainwnd.obj & $(OBJDIR)mainwnd2.obj $(OBJDIR)makelist.obj $(OBJDIR)menu.obj & $(OBJDIR)misc.obj $(OBJDIR)mkdir.obj $(OBJDIR)mle.obj $(OBJDIR)newview.obj & $(OBJDIR)notebook.obj $(OBJDIR)notify.obj $(OBJDIR)objcnr.obj & $(OBJDIR)objwin.obj $(OBJDIR)pathutil.obj $(OBJDIR)presparm.obj & $(OBJDIR)printer.obj $(OBJDIR)remap.obj $(OBJDIR)rename.obj & $(OBJDIR)saveclip.obj $(OBJDIR)seeall.obj $(OBJDIR)select.obj & $(OBJDIR)seticon.obj $(OBJDIR)shadow.obj $(OBJDIR)sortcnr.obj & $(OBJDIR)srchpath.obj $(OBJDIR)strutil.obj $(OBJDIR)strips.obj & $(OBJDIR)stristr.obj $(OBJDIR)subj.obj $(OBJDIR)sysinfo.obj $(OBJDIR)systemf.obj & $(OBJDIR)timer.obj $(OBJDIR)tmrsvcs.obj $(OBJDIR)tools.obj $(OBJDIR)treecnr.obj & $(OBJDIR)undel.obj $(OBJDIR)update.obj $(OBJDIR)uudecode.obj & $(OBJDIR)valid.obj $(OBJDIR)viewer.obj $(OBJDIR)viewinf.obj $(OBJDIR)walkem.obj & $(OBJDIR)winlist.obj $(OBJDIR)worker.obj $(OBJDIR)wrappers.obj ICONS = icons\*.ico ..\icons\*.ico icons\*.ptr !ifndef MAKERES all: & $(BINDIR)$(BASE).dll & $(BASERES).res & $(BINDIR)$(BASERES).dll & $(BASERESDE).res & $(BINDIR)$(BASERESDE).dll & $(SYMS) & ipf\EN\fm3.hlp & ipf\DE\fm3de.hlp syms: $(SYMS) .symbolic $(BINDIR)$(BASE).dll $(BINDIR)$(BASE).lib $(BINDIR)$(BASE).map: $(OBJS) $(BASE).def $(BASE).lrf @echo Linking $(BASE).dll $(LINK) @$(BASE).lrf @$(BASE).def @rem type $(BASE).lrf # !ifndef NOHIGHMEM # @echo. # @echo Setting highmem objects in $(BASE).dll # @echo. # !exehdr /hi $(BASE).dll # !endif $(BASE).lrf: $(__MAKEFILES__) @%write $^@ $(LFLAGS) op map=$(BINDIR)$(BASE).map sort global #map=$(BINDIR)$(BASE).map sort global @%append $^@ name $(BINDIR)$(BASE) @for %f in ($(OBJS)) do @%append $^@ file %f @%append $^@ library $(BINDIR)os2386.lib !ifdef PMPRINTF @%append $^@ library PMPRINTF.LIB !endif !else # MAKERES defined # MAKERES mode - build resources only all: $(BASERES).res & $(BINDIR)$(BASERES).dll & $(BASERESDE).res & $(BINDIR)$(BASERESDE).dll & ipf\EN\fm3.hlp & ipf\DE\fm3de.hlp !endif # MAKERES # Update resources only res: @echo Updating resources only $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) MAKERES=1 $(OBJDIR)$(BASERES).obj: $(BASERES).c .AUTODEPEND $(CC) $(CFLAGSR) -fo=$(OBJDIR) $(BASERES).c $(BASERES).res: $(BASERES).rc $(BASERES).dlg fm3dll2.h fm3dlg.h copyright.h $(ICONS) @echo. @echo Compiling English resource: $* @echo. $(RC) $(RCFLAGS) $* !ifdef USE_RC ren $*.res $*.res !endif $(BASERESDE).res: $(BASERESDE).rc $(BASERESDE).dlg fm3dll2.h fm3dlg.h copyright.h $(ICONS) @echo. @echo Compiling German resource: $* @echo. $(RC) $(RCFLAGS) $* !ifdef USE_RC ren $*.res $*.res !endif !ifndef MAKERES $(BINDIR)$(BASERES).dll $(BINDIR)$(BASERES).lib $(BINDIR)$(BASERES).map: $(BASERES).res $(OBJDIR)$(BASERES).obj $(BASERES).def $(BASERES).lrf @echo Linking $(BINDIR)$(BASERES).dll $(LINK) @$(BASERES).lrf @$(BASERES).def @echo. @echo Attaching resources to $(BASERES).dll @echo. $(RC) $(RCFLAGS2) $(BASERES).res $(BINDIR)$(BASERES).dll # !ifndef NOHIGHMEM # @echo. # @echo Setting highmem objects in $(BASERES).dll # @echo. # !exehdr /hi:1,2 $(BASERES).dll # !endif $(BINDIR)$(BASERESDE).dll $(BINDIR)$(BASERESDE).lib $(BINDIR)$(BASERESDE).map: $(BASERESDE).res $(OBJDIR)$(BASERES).obj $(BASERESDE).def $(BASERESDE).lrf @echo Linking $(BINDIR)$(BASERESDE).dll $(LINK) @$(BASERESDE).lrf @$(BASERESDE).def @echo. @echo Attaching resources to $(BASERESDE).dll @echo. $(RC) $(RCFLAGS2) $(BASERESDE).res $(BINDIR)$(BASERESDE).dll # !ifndef NOHIGHMEM # @echo. # @echo Setting highmem objects in $(BASERES).dll # @echo. # !exehdr /hi:1,2 $(BASERES).dll # !endif $(BASERES).lrf: $(__MAKEFILES__) @%write $^@ $(LFLAGS) op map=$(BINDIR)$(BASERES).map sort global @%append $^@ name $(BINDIR)$(BASERES) @for %f in ($(OBJDIR)$(BASERES).obj) do @%append $^@ file %f $(BASERESDE).lrf: $(__MAKEFILES__) @%write $^@ $(LFLAGS) op map=$(BINDIR)$(BASERESDE).map sort global @%append $^@ name $(BINDIR)$(BASERESDE) @for %f in ($(OBJDIR)$(BASERES).obj) do @%append $^@ file %f $(BINDIR)$(BASE).sym: $(BINDIR)$(BASE).map .explicit @echo Processing: $? cd $(BINDIR). -perl ..\..\..\debugtools\mapsymw.pl $(BASE).map cd ..\.. $(BINDIR)$(BASE).xqs: $(BINDIR)$(BASE).map .explicit @echo Processing: $? cd $(BINDIR). -mapxqs $(BASE).map cd ..\.. $(BINDIR)$(BASERES).sym: $(BINDIR)$(BASERES).map .explicit @echo Processing: $? cd $(BINDIR). -perl ..\..\..\debugtools\mapsymw.pl $(BASERES).map CD ..\.. $(BINDIR)$(BASERES).xqs: $(BINDIR)$(BASERES).map .explicit @echo Processing: $? cd $(BINDIR). -mapxqs $(BASERES).map cd ..\.. $(BINDIR)$(BASERESDE).sym: $(BINDIR)$(BASERESDE).map .explicit @echo Processing: $? cd $(BINDIR). -perl ..\..\..\debugtools\mapsymw.pl $(BASERESDE).map cd ..\.. $(BINDIR)$(BASERESDE).xqs: $(BINDIR)$(BASERESDE).map .explicit @echo Processing: $? cd $(BINDIR). -mapxqs $(BASERESDE).map cd ..\.. !else # MAKERES defined # MAKERES mode - build resources only $(BASERES).dll: $(BASERES).res @if not exist $@ echo $@ missing !ifndef DEBUG lxlite $@ /x+ /b- lxlite $@ /c:minstub !endif @echo. @echo Attaching resources to $@ @echo. $(RC) $(RCFLAGS2) $(BASERES).res $@ !ifndef DEBUG lxlite $@ /x- /b- !endif !endif # MAKERES # For testing new code tmp.obj: tmp.c ipf: ipf\EN\fm3.hlp ipf\DE\fm3de.hlp .symbolic ipf\EN\fm3.hlp: ipf\EN\*.ipf ipf\bitmaps\*.bmp ipf\EN\makefile cd ipf\EN $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) fm3.hlp cd ..\.. ipf\DE\fm3de.hlp: ipf\DE\*.ipf ipf\bitmaps\*.bmp ipf\DE\makefile cd ipf\DE $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) fm3de.hlp cd ..\.. # Run for each dependent lxlite: $(BASE).dll $(BASERES).dll $(BASERESDE).dll .symbolic # !lxlite /x- /b- $? !ifndef DEBUG @for %f in ($(BASE).dll $(BASERES).dll $(BASERESDE).dll) do !lxlite /x- /b- %f !endif cleanobj: .symbolic -del *.obj clean: .symbolic cd ipf\EN $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) clean cd ..\.. cd ipf\DE $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) clean cd ..\.. -del $(BINDIR)*.dll -del $(BINDIR)*.lib -del *.lrf -del $(BINDIR)*.map -del $(BINDIR)*.map-ibm -del *.obj -del *.res -del $(BINDIR)*.sym -del $(BINDIR)*.xqs -del *~ # eof