--- mstools/samples/rpc/dict/makefile 2018/08/09 18:22:06 1.1.1.3 +++ mstools/samples/rpc/dict/makefile 2018/08/09 18:24:20 1.1.1.4 @@ -1,3 +1,4 @@ + #*************************************************************# #** **# #** Microsoft RPC Examples **# @@ -6,285 +7,83 @@ #** **# #*************************************************************# -#################################################################### -# ----- 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)" == "MIPS" -NT_MIPS=1 -!else if "$(CPU)" == "I386" -NT_I386=1 -!endif - -!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) ) ) - -# ----- NT_I386 ENVIRONMENT DEFINITIONS ----- - -!ifdef NT_I386 - -NTLIB= - -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 /Gz /Ox /Oy1 - -!endif -# NT_I386 - -# ----- NT_MIPS ENVIRONMENT DEFINITIONS ----- - -!ifdef NT_MIPS - -NTLIB = - -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! -# - -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 - -!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) +!include +!if "$(CPU)" == "i386" +cflags = $(cflags:G3=Gz) !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) ) +.c.obj: + $(cc) $(cdebug) $(cflags) $(cvars) $< all : client.exe server.exe play.exe -!else -# ifdef DOS - -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) +# Make the client +client : client.exe +client.exe : client.obj util0.obj replay_c.obj replay_x.obj + $(link) $(linkdebug) $(conflags) -out:client.exe -map:client.map \ + client.obj util0.obj replay_c.obj replay_x.obj \ + rpcrt4.lib $(conlibs) + +# dict client main program +client.obj : client.c util0.h replay.h + +# dict client stub +replay_x.obj : replay_x.c replay.h + +# dict client auxiliary file +replay_c.obj : replay_c.c replay.h + +# Make the server executable +server : server.exe +server.exe : server.obj util0.obj replay_s.obj replay_y.obj replay.obj dict0.obj + $(link) $(linkdebug) $(conflags) -out:server.exe -map:server.map \ + server.obj util0.obj replay_s.obj replay_y.obj replay.obj dict0.obj \ + rpcrt4.lib $(conlibs) + +# dict server main program +server.obj : server.c util0.h replay.h + +# dict remote procedures +replay.obj : replay.c util0.h replay.h -!endif - - -play.exe : play.$(OBJ) lutil0.$(OBJ) dict0.$(OBJ) - $(PLAYLINK) - -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 - - -!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 +# dict server stub +replay_y.obj : replay_y.c replay.h -!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 +# dict server auxiliary file +replay_s.obj : replay_s.c replay.h -!endif -# NT_MIPS - -!ifdef NT_I386 +# make the local executable +play : play.exe +play.exe : play.obj lutil0.obj dict0.obj + $(link) $(linkdebug) $(conflags) -out:play.exe -map:play.map \ + play.obj lutil0.obj dict0.obj \ + $(conlibs) -lutil0.$(OBJ) : util0.h util0.c - $(CC) $(NTCCFLAGS) $(NTCCFLAGS0) $(NTCCFLAGS1) $(NTINC) $(NTDEF) -D_LOCAL -Folutil0.$(OBJ) util0.c - $(CVTOMF) lutil0.$(OBJ) +# dict local main program +play.obj : play.c util0.h dict0.h -!endif -# NT_I386 +dict0.obj : dict0.c dict0.h -dict0.$(OBJ) : dict0.h dict0.c +util0.obj : util0.c util0.h -play.$(OBJ) : play.c util0.h dict0.h +lutil0.obj : util0.c util0.h + copy util0.c lutil0.c + $(cc) $(cdebug) $(cflags) $(cvars) -D_LOCAL lutil0.c + del lutil0.c +# Stubs, auxiliary and header file from the IDL file replay.h replay_s.c replay_c.c replay_y.c replay_x.c : replay.idl replay.acf - $(MIDL) $(DEF) replay.idl + midl -cpp_cmd $(cc) -cpp_opt "-E" replay.idl -play : play.exe +# Clean up everything +cleanall : clean + -del *.exe +# Clean up everything but the .EXEs clean : - -del *.$(OBJ) + -del *.obj + -del *.map + -del replay_?.c -del replay.h - -del replay_?.* -cleanall : - -del *.$(OBJ) - -del replay.h - -del replay_?.* - -del *.exe