--- mstools/samples/rpc/dict/makefile 2018/08/09 18:20:01 1.1.1.1 +++ mstools/samples/rpc/dict/makefile 2018/08/09 18:20:57 1.1.1.2 @@ -1,4 +1,3 @@ - #*************************************************************# #** **# #** Microsoft RPC Examples **# @@ -6,107 +5,286 @@ #** Copyright(c) Microsoft Corp. 1991 **# #** **# #*************************************************************# -# Nmake macros for building Windows 32-Bit apps -!include +#################################################################### +# ----- The following is an example of a makefile +# ----- which would work the same both for cross compiling +# ----- Other OS => NT or NT => NT. To build on in the PDK +# ----- environment, just type "nmake all"; in the standard +# ----- deve. environment type "nmake NT_I386= all". +#################################################################### -!if "$(CPU)" == "i386" -COMPILECOMMAND = $(cc) $(cflags) $(cvars) -W1COMPILECOMMAND = $(cc) $(cflags) $(cvars) -W1 -CONVERTOBJECTCMD = $(cvtobj) $@ -.c.obj: - $(COMPILECOMMAND) $< - $(CONVERTOBJECTCMD) +!if "$(CPU)" == "MIPS" +NT_MIPS=1 +!else if "$(CPU)" == "I386" +NT_I386=1 !endif -!if "$(CPU)" == "MIPS" -COMPILECOMMAND = $(cc) $(cflags) $(cvars) -w1cflags = -c -G0 -O -EL -DMIPS=1 -I\nt\mstools\h -W1COMPILECOMMAND = $(cc) $(w1cflags) $(cvars) -CONVERTOBJECTCMD = $(cvtobj) -.c.obj: - $(W1COMPILECOMMAND) $< - $(CONVERTOBJECTCMD) +!if ( ! ( defined(NT_I386) || defined(NT_MIPS) || defined(DOS) ) ) +!error You forgot to define NT_I386 or NT_MIPS or DOS !!! !endif +#if ( ! ( defined(NT_I386) || defined(NT_MIPS) || defined(DOS) ) ) -all : client.exe server.exe play.exe +# ----- NT_I386 ENVIRONMENT DEFINITIONS ----- + +!ifdef NT_I386 + +NTLIB=$(LIB) + +CC = cl386 +EXPAND = -E +MIDL = midl +CVTOMF_COMMAND = $(CVTOMF) $*.obj +CVTOMF = cvtomf +COFF = coff +CPU=i386 +OBJ = obj + +NTCCFLAGS = -nologo -I . +NTCCFLAGS0 = -Di386=1 -DCONDITION_HANDLING=1 -DNT_UP=1 +NTCCFLAGS1 = -DNT_INST=0 -DDBG=0 -DDEVL=1 -DNT_HOST /c /Zel /W2 /G3d /Ox /Oy1 + +!endif +# NT_I386 + +# ----- NT_MIPS ENVIRONMENT DEFINITIONS ----- + +!ifdef NT_MIPS -client.exe : client.obj util0.obj replay_c.obj replay_x.obj - $(link) $(conflags) -out:client.exe \ - client.obj util0.obj replay_c.obj replay_x.obj \ - $(conlibs) $(LIB)\winrpc.lib $(LIB)\ndrlib.lib - -server.exe : server.obj util0.obj replay_s.obj replay_y.obj \ - replay.obj dict0.obj - $(link) $(conflags) -out:server.exe \ - server.obj util0.obj replay_s.obj replay_y.obj \ - replay.obj dict0.obj \ - $(conlibs) $(LIB)\winrpc.lib $(LIB)\ndrlib.lib - -play.exe : play.obj lutil0.obj dict0.obj - $(link) $(conflags) -out:play.exe \ - play.obj lutil0.obj dict0.obj replay_c.obj replay_x.obj \ - $(conlibs) $(LIB)\winrpc.lib $(LIB)\ndrlib.lib - -client.obj : client.c util0.h replay.h - -server.obj : server.c util0.h replay.h - -replay.obj : util0.h replay.h replay.c - -util0.obj : util0.h util0.c replay.h - -# use common source code for both RPC and standalone version -# the standalone version is compiled using the _LOCAL flag -# use different command line input for different operating systems +NTLIB = $(LIB) + +CC = cc +MIDL = midl +CVTOMF_COMMAND = $(CVTOMF) +CVTOMF = mip2coff $@ +COFF = coff +CPU=mips +OBJ = o + +NTCCFLAGS = -c -std -excpt -G04 -g0 -O -EL -Wab,-mips2 -Wab,-diag -Wb,-dwalign -checkstack 4096 +NTCCFLAGS0 = -G0 -checkstack 4096 -I. +NTCCFLAGS1 = -DMIPS=1 -DNO_EXT_KEYS -DMIPSEL -DCONDITION_HANDLING=1 -DJAZZ -DR4000 -DDBG=0 -DNTENV -DDBG=0 + +!endif +# NT_MIPS + +# ----- DOS ENVIRONMENT DEFINITIONS ----- + +!ifdef DOS + +_NTDRIVE = C: + +NT = $(_NTDRIVE)\nt\public\sdk +NTLIB = + +CC = cl +EXPAND = -E +MIDL = midl +CPU=i386 +OBJ = obj +DEF = + +# +# DEF = /Zp4 +# Requires surrounding all public RPC defs in rpc.h & rpcndr.h +# by a #pragma pack(2) ... #pragma pack() pair! # -!if "$(CPU)" == "i386" -lutil0.obj : util0.h util0.c - $(cc) $(cflags) -Folutil0.obj -D_LOCAL util0.c - $(cvtobj) lutil0.obj + +NTCCFLAGS = -I . -I c:\c700\include -I c:\c700\include\dos + +NTCCFLAGS0 = /AL + +!ifdef DBG +NTCCFLAGS1 = /c /Zel /W2 /Od /Zi +!else +NTCCFLAGS1 = /c /Zel /W2 /Otnlgei + +# NTCCFLAGS1 = /c /Zel /W2 /Osqfv + +# +# Warning: For client.exe: do not use /Ox or /Oz with /Zp4! +# For play.exe: do not use /Oa or /Ow with /Ol, /Og, or /Oe! +# This program must be compiled large model (/AL) on DOS +# + !endif +# DBG -!if "$(CPU)" == "MIPS" -lutil0.obj : util0.h util0.c replay.h - cp util0.obj saved - $(cc) $(cflags) $(cvars) -D_LOCAL util0.c - mip2coff util0.o & del util0.o & rename util0.oo lutil0.obj - cp saved util0.obj & del saved +!endif +# DOS + +# ----- END INDIVIDUAL ENVIRONMENT DEFINITIONS ----- + +#################################################################### + +# ----- COMPILER & LINKER ENVIRONMENT DEPENDENT DEFINITIONS ----- + +!if ( defined(NT_I386) || defined(NT_MIPS) ) + +# ----- Now NT, CVTOMF, COFF, CC, and MIDL are all defined for +# ----- both NT (I386 and MIPS) working environments ... + +#################################################################### + +# ----- now that all flags to the C compiler $(CC) are defined, +# ----- we will call $(CC) $(NTCCFLAGS) $(NTINC) and $(NTDEF) +# ----- Use the following fancy rule: + +.c.$(OBJ): + $(CC) $(NTCCFLAGS) $(NTCCFLAGS0) $(NTCCFLAGS1) $(NTINC) $(DEF) $< + $(CVTOMF_COMMAND) + + +# ----- The first inference rule above calls the C compiler (with +# ----- the appropriate flags) on each .c file to produce a .$(OBJ) +# ----- file, for every dependency of .$(OBJ) on .c (+.h) files. +# ----- The second rule calls CVTOMF on every target produced by the +# ----- first rule. + +#################################################################### + + +# ----- Finally, use the next clever rule to produce .exe files +# ----- by calling the linker (COFF with the appropriate +# ----- switches), substituting the target .exe for the +# ----- predefined macro $* for each target exe (minus the +# ----- .exe extension), and substituting the right hand +# ----- side of the rule for the predefined $** macro + +NTLINK = $(COFF) -link -pe -out:$*.exe \ +-debug:partial \ +-machine:$(CPU) \ +-subsystem:console \ +# -base:@$(NT)\LIB\coffbase.txt,usermode \ +-entry:mainCRTStartup \ +$** \ +$(NTLIB)\ntdll.lib \ +$(NTLIB)\kernel32.lib \ +$(NTLIB)\libc.lib \ +$(NTLIB)\rpcrt4.lib \ +$(NTLIB)\rpcndr.lib + +PLAYLINK = $(NTLINK) + +!endif +# ( defined(NT_I386) || defined(NT_MIPS) ) + +!ifdef DOS + +.c.$(OBJ): + $(CC) $(NTCCFLAGS) $(NTCCFLAGS0) $(NTCCFLAGS1) $(NTINC) $(DEF) $< + +!ifdef DBG +NTLINK = link @dictdbg.lnk +!else +NTLINK = link @dict.lnk +!endif +# DBG + +PLAYLINK = link @play.lnk + +CVTOMF = $(NTLINK) -dict0.obj : dict0.h dict0.c !endif +# DOS + +#################################################################### +# ----- Now, that all the hard work was done, we are finally ready +# ----- for some simple dependency rules: +#################################################################### + +!if ( defined(NT_I386) || defined(NT_MIPS) ) + +all : client.exe server.exe play.exe + +!else +# ifdef DOS -play.obj : play.c util0.h dict0.h +all : client.exe play.exe + +!endif +#if ( defined(NT_I386) || defined(NT_MIPS) ) + +client.exe : client.$(OBJ) util0.$(OBJ) \ + replay_c.$(OBJ) replay_x.$(OBJ) + $(NTLINK) + +!ifdef AUTOHANDLE + +server.exe : server.$(OBJ) util0.$(OBJ) \ + replay_s.$(OBJ) replay_y.$(OBJ) \ +# ..\obj\i386\nsisvr.obj ..\obj\i386\sbindapi.obj \ +# ..\obj\i386\locsvr_c.obj ..\obj\i386\locsvr_x.obj \ + replay.$(OBJ) dict0.$(OBJ) + $(NTLINK) + +!else + +server.exe : server.$(OBJ) util0.$(OBJ) \ + replay_s.$(OBJ) replay_y.$(OBJ) \ + replay.$(OBJ) dict0.$(OBJ) + $(NTLINK) + +!endif -# compile the stubs at a lower warning level -replay_c.obj : replay_c.c replay.h - $(W1COMPILECOMMAND) replay_c.c - $(CONVERTOBJECTCMD) -replay_s.obj : replay_s.c replay.h - $(W1COMPILECOMMAND) replay_s.c - $(CONVERTOBJECTCMD) +play.exe : play.$(OBJ) lutil0.$(OBJ) dict0.$(OBJ) + $(PLAYLINK) -replay_x.obj : replay_x.c replay.h - $(W1COMPILECOMMAND) replay_x.c - $(CONVERTOBJECTCMD) +client.$(OBJ) : client.c util0.h replay.h -replay_y.obj : replay_y.c replay.h - $(W1COMPILECOMMAND) replay_y.c - $(CONVERTOBJECTCMD) +server.$(OBJ) : server.c util0.h replay.h + +replay.$(OBJ) : util0.h replay.h replay.c + +util0.$(OBJ) : util0.h util0.c + + +!ifdef DOS + +lutil0.$(OBJ) : util0.h util0.c + copy util0.c lutil0.c + $(CC) $(NTCCFLAGS) $(NTCCFLAGS0) $(NTCCFLAGS1) $(NTINC) $(NTDEF) -D_LOCAL lutil0.c + del lutil0.c + +!endif +# DOS +!ifdef NT_MIPS + +lutil0.$(OBJ) : util0.h util0.c + copy util0.c lutil0.c + $(CC) $(NTCCFLAGS) $(NTCCFLAGS0) $(NTCCFLAGS1) $(NTINC) $(NTDEF) -D_LOCAL lutil0.c + $(CVTOMF) lutil0.$(OBJ) + del lutil0.c + +!endif +# NT_MIPS + +!ifdef NT_I386 + +lutil0.$(OBJ) : util0.h util0.c + $(CC) $(NTCCFLAGS) $(NTCCFLAGS0) $(NTCCFLAGS1) $(NTINC) $(NTDEF) -D_LOCAL -Folutil0.$(OBJ) util0.c + $(CVTOMF) lutil0.$(OBJ) + +!endif +# NT_I386 + +dict0.$(OBJ) : dict0.h dict0.c + +play.$(OBJ) : play.c util0.h dict0.h replay.h replay_s.c replay_c.c replay_y.c replay_x.c : replay.idl replay.acf - midl -cpp_cmd $(cc) -cpp_opt "-E" replay.idl + $(MIDL) $(DEF) replay.idl play : play.exe clean : - -del *.exe - + -del *.$(OBJ) + -del replay.h + -del replay_?.* -cleanall : clean - -del *.o - -del *.oo +cleanall : + -del *.$(OBJ) -del replay.h -del replay_?.* - -del *.obj + -del *.exe