home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Compilers / digital marsC compier / dm / include / win32 / Win32.mak < prev    next >
Encoding:
Text File  |  1996-08-08  |  14.7 KB  |  463 lines

  1. # =========================================================================
  2. # WIN32.MAK - Win32 application master NMAKE definitions file for the
  3. #               Microsoft Win32 SDK for Windows programming samples
  4. # -------------------------------------------------------------------------
  5. # This files should be included at the top of all MAKEFILEs as follows:
  6. #  !include <win32.mak>
  7. # -------------------------------------------------------------------------
  8. #
  9. # Define APPVER = [ 3.51 | 4.0 ] prior to including win32.mak to get
  10. #  build time checking for version dependencies and to mark the executable
  11. #  with version information.
  12. #
  13. # Define TARGETOS = [ WIN95 | WINNT | BOTH ] prior to including win32.mak
  14. #  to get some build time checking for platform dependencies.
  15. #
  16. # Define TARGETLANG = [ LANG_JAPANESE ] prior to including win32.mak to get
  17. #  compile & link flags for building applications to run on Japanese Windows.
  18. #  (This is an optional parameter.  The system locale is the default.)
  19. #
  20. # -------------------------------------------------------------------------
  21. # NMAKE Options
  22. #
  23. # Use the table below to determine the additional options for NMAKE to
  24. # generate various application debugging, profiling and performance tuning
  25. # information.
  26. #
  27. # Application Information Type         Invoke NMAKE
  28. # ----------------------------         ------------
  29. # For No Debugging Info                nmake nodebug=1
  30. # For Working Set Tuner Info           nmake tune=1
  31. # For Call Attributed Profiling Info   nmake profile=1
  32. #
  33. # Note: The three options above are mutually exclusive (you may use only
  34. #       one to compile/link the application).
  35. #
  36. # Note: creating the environment variables NODEBUG, TUNE, and PROFILE is an
  37. #       alternate method to setting these options via the nmake command line.
  38. #
  39. # Additional NMAKE Options             Invoke NMAKE
  40. # ----------------------------         ------------
  41. # For No ANSI NULL Compliance          nmake no_ansi=1
  42. # (ANSI NULL is defined as PVOID 0)
  43. #
  44. # =========================================================================
  45.  
  46. !IFNDEF _WIN32_MAK_
  47. _WIN32_MAK_ = 1
  48.  
  49. # -------------------------------------------------------------------------
  50. # Get CPU Type - exit if CPU environment variable is not defined
  51. # -------------------------------------------------------------------------
  52.  
  53. !IF "$(CPU)" == ""
  54. CPU = i386
  55. !ENDIF
  56.  
  57. !IF "$(CPU)" != "i386"
  58. !IF "$(CPU)" != "MIPS"
  59. !IF "$(CPU)" != "ALPHA"
  60. !IF "$(CPU)" != "PPC"
  61. !ERROR  Must specify CPU environment variable ( CPU=i386, CPU=MIPS, CPU=ALPHA, CPU=PPC)
  62. !ENDIF
  63. !ENDIF
  64. !ENDIF
  65. !ENDIF
  66.  
  67.  
  68. # -------------------------------------------------------------------------
  69. # Get Target Operating System - Default to WINNT
  70. # -------------------------------------------------------------------------
  71. !IFNDEF TARGETOS
  72. TARGETOS = WINNT
  73. !ENDIF
  74.  
  75. !IF "$(TARGETOS)" != "WINNT"
  76. !IF "$(TARGETOS)" != "WIN95"
  77. !IF "$(TARGETOS)" != "BOTH"
  78. !ERROR Must specify TARGETOS environment variable (BOTH, WIN95, WINNT)
  79. !ENDIF
  80. !ENDIF
  81. !ENDIF
  82.  
  83.  
  84. !IFNDEF APPVER
  85. APPVER = 4.0
  86. !ENDIF
  87.  
  88. !IF "$(APPVER)" != "4.0"
  89. !IF "$(APPVER)" != "3.51"
  90. !ERROR Must specify APPVER environment variable (3.51, 4.0)
  91. !ENDIF
  92. !ENDIF
  93.  
  94. # binary declarations common to all platforms
  95. cc     = cl
  96. rc     = rc
  97. link   = link
  98. implib = lib
  99. hc     = hcrtf -xn
  100.  
  101. # for compatibility with older-style makefiles
  102. cvtobj = REM !!! CVTOBJ is no longer necessary - please remove !!!
  103. cvtres = REM !!! CVTRES is no longer necessary - please remove !!!
  104.  
  105.  
  106. # -------------------------------------------------------------------------
  107. # Platform Dependent Compile Flags - must be specified after $(cc)
  108. #
  109. # Note: Debug switches are on by default for current release
  110. #
  111. # These switches allow for source level debugging with WinDebug for local
  112. # and global variables.
  113. #
  114. # Both compilers now use the same front end - you must still define either
  115. # _X86_, _MIPS_, _PPC_ or _ALPHA_.  These have replaced the i386, MIPS, and ALPHA
  116. # definitions which are not ANSI compliant.
  117. #
  118. # Common compiler flags:
  119. #   -c   - compile without linking
  120. #   -W3  - Set warning level to level 3
  121. #   -Zi  - generate debugging information
  122. #   -Od  - disable all optimizations
  123. #   -Ox  - use maximum optimizations
  124. #   -Zd  - generate only public symbols and line numbers for debugging
  125. #
  126. # i386 specific compiler flags:
  127. #   -Gz  - stdcall
  128. #
  129. # -------------------------------------------------------------------------
  130.  
  131. # declarations common to all compiler options
  132. ccommon = -c -W3 -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo
  133.  
  134. # for compatibility with old source code, map {try, except, leave, finally}
  135. # to their proper names (i.e. prefaced by "__")
  136. !IFDEF SEHMAP
  137. ccommon = $(ccommon) -FIsehmap.h
  138. !ENDIF
  139.  
  140. !IF "$(TARGETLANG)" == "LANG_JAPANESE"
  141. ccommon = $(ccommon) -DJAPAN -DDBCS -DFE_IME
  142. !ENDIF
  143.  
  144. !IF "$(TARGETLANG)" == "LANG_CHINESE"
  145. ccommon = $(ccommon) -DDBCS -DFE_IME
  146. !ENDIF
  147.  
  148. !IF "$(TARGETLANG)" == "LANG_KOREAN"
  149. ccommon = $(ccommon) -DDBCS -DFE_IME
  150. !ENDIF
  151.  
  152.  
  153.  
  154. !IF "$(CPU)" == "i386"
  155. cflags = $(ccommon) -D_X86_=1
  156. scall  = -Gz
  157. !ELSE
  158. !IF "$(CPU)" == "MIPS"
  159. cflags = $(ccommon) -D_MIPS_=1
  160. !ELSE
  161. !IF "$(CPU)" == "PPC"
  162. cflags = $(ccommon) -D_PPC_=1
  163. !ELSE
  164. !IF "$(CPU)" == "ALPHA"
  165. cflags = $(ccommon) -D_ALPHA_=1
  166. !ENDIF
  167. !ENDIF
  168. !ENDIF
  169. scall  =
  170. !ENDIF
  171.  
  172. !IF "$(TARGETOS)" == "WINNT"
  173. cflags = $(cflags) -D_WINNT -D_WIN32_WINNT=0x0400
  174. !ELSE
  175. !IF "$(TARGETOS)" == "WIN95"
  176. cflags = $(cflags) -D_WIN95 -D_WIN32_WINDOWS=0x0400
  177. !ENDIF
  178. !ENDIF
  179.  
  180. # For this release, for all values of APPVER, WINVER is 0x0400
  181. cflags = $(cflags) -DWINVER=0x0400
  182.  
  183.  
  184. !IFDEF NODEBUG
  185. cdebug = -Ox
  186. !ELSE
  187. !IFDEF PROFILE
  188. cdebug = -Gh -Zd -Ox
  189. !ELSE
  190. !IFDEF TUNE
  191. cdebug = -Gh -Zd -Ox
  192. !ELSE
  193. cdebug = -Z7 -Od
  194. !ENDIF
  195. !ENDIF
  196. !ENDIF
  197.  
  198. # -------------------------------------------------------------------------
  199. # Target Module & Subsystem Dependent Compile Defined Variables - must be
  200. #   specified after $(cc)
  201. #
  202. # The following table indicates the various acceptable combinations of
  203. # the C Run-Time libraries LIBC, LIBCMT, and CRTDLL respect to the creation
  204. # of a EXE and/or DLL target object.  The appropriate compiler flag macros
  205. # that should be used for each combination are also listed.
  206. #
  207. #  Link EXE    Create Exe    Link DLL    Create DLL
  208. #    with        Using         with         Using
  209. # ----------------------------------------------------
  210. #  LIBC        CVARS          None        None      *
  211. #  LIBC        CVARS          LIBC        CVARS
  212. #  LIBC        CVARS          LIBCMT      CVARSMT
  213. #  LIBCMT      CVARSMT        None        None      *
  214. #  LIBCMT      CVARSMT        LIBC        CVARS
  215. #  LIBCMT      CVARSMT        LIBCMT      CVARSMT
  216. #  CRTDLL      CVARSDLL       None        None      *
  217. #  CRTDLL      CVARSDLL       LIBC        CVARS
  218. #  CRTDLL      CVARSDLL       LIBCMT      CVARSMT
  219. #  CRTDLL      CVARSDLL       CRTDLL      CVARSDLL  *
  220. #
  221. # * - Denotes the Recommended Configuration
  222. #
  223. # When building single-threaded applications you can link your executable
  224. # with either LIBC, LIBCMT, or CRTDLL, although LIBC will provide the best
  225. # performance.
  226. #
  227. # When building multi-threaded applications, either LIBCMT or CRTDLL can
  228. # be used as the C-Runtime library, as both are multi-thread safe.
  229. #
  230. # Note: Any executable which accesses a DLL linked with CRTDLL.LIB must
  231. #       also link with CRTDLL.LIB instead of LIBC.LIB or LIBCMT.LIB.
  232. #       When using DLLs, it is recommended that all of the modules be
  233. #       linked with CRTDLL.LIB.
  234. #
  235. # Note: The macros of the form xDLL are used when linking the object with
  236. #       the DLL version of the C Run-Time (that is, CRTDLL.LIB).  They are
  237. #       not used when the target object is itself a DLL.
  238. #
  239. # -------------------------------------------------------------------------
  240.  
  241. !IFDEF NO_ANSI
  242. noansi = -DNULL=0
  243. !ENDIF
  244.  
  245. # for Windows applications that use the C Run-Time libraries
  246. cvars      = -DWIN32 $(noansi) -D_WIN32
  247. cvarsmt    = $(cvars) -D_MT -MT
  248. cvarsdll   = $(cvars) -D_MT -D_DLL -MD
  249.  
  250. # for compatibility with older-style makefiles
  251. cvarsmtdll   = $(cvarsmt) -D_DLL
  252.  
  253. # for POSIX applications
  254. psxvars    = -D_POSIX_
  255.  
  256. # resource compiler
  257. rcflags = /r
  258. rcvars = -DWIN32 -D_WIN32 -DWINVER=0x0400 $(noansi)
  259.  
  260. !IF "$(TARGETLANG)" == "LANG_JAPANESE"
  261. rcflags = $(rcflags) /c932
  262. rcvars = $(rcvars) -DJAPAN -DDBCS -DFE_IME
  263. !ENDIF
  264.  
  265. !IF "$(TARGETLANG)" == "LANG_CHINESE"
  266. rcvars = $(rcvars) -DDBCS -DFE_IME
  267. !ENDIF
  268.  
  269. !IF "$(TARGETLANG)" == "LANG_KOREAN"
  270. rcvars = $(rcvars) -DDBCS -DFE_IME
  271. !ENDIF
  272.  
  273.  
  274.  
  275. # -------------------------------------------------------------------------
  276. # Platform Dependent Link Flags - must be specified after $(link)
  277. #
  278. # Note: $(DLLENTRY) should be appended to each -entry: flag on the link
  279. #       line.
  280. #
  281. # Note: When creating a DLL that uses C Run-Time functions it is
  282. #       recommended to include the entry point function of the name DllMain
  283. #       in the DLL's source code.  Also, the MAKEFILE should include the
  284. #       -entry:_DllMainCRTStartup$(DLLENTRY) option for the creation of
  285. #       this DLL.  (The C Run-Time entry point _DllMainCRTStartup in turn
  286. #       calls the DLL defined DllMain entry point.)
  287. #
  288. # -------------------------------------------------------------------------
  289.  
  290. # declarations common to all linker options
  291. lflags  = /NODEFAULTLIB /INCREMENTAL:NO /PDB:NONE /RELEASE /NOLOGO
  292.  
  293. # declarations for use on Intel i386, i486, and Pentium systems
  294. !IF "$(CPU)" == "i386"
  295. DLLENTRY = @12
  296. !ENDIF
  297.  
  298. # declarations for use on self hosted MIPS R4x000 systems
  299. !IF "$(CPU)" == "MIPS"
  300. DLLENTRY =
  301. !ENDIF
  302.  
  303. # declarations for use on self hosted PowerPC systems
  304. !IF "$(CPU)" == "PPC"
  305. DLLENTRY =
  306. !ENDIF
  307.  
  308. # declarations for use on self hosted Digital Alpha AXP systems
  309. !IF "$(CPU)" == "ALPHA"
  310. DLLENTRY =
  311. !ENDIF
  312.  
  313. # -------------------------------------------------------------------------
  314. # Target Module Dependent Link Debug Flags - must be specified after $(link)
  315. #
  316. # These switches allow the inclusion of the necessary symbolic information
  317. # for source level debugging with WinDebug, profiling and/or performance
  318. # tuning.
  319. #
  320. # Note: Debug switches are on by default.
  321. # -------------------------------------------------------------------------
  322.  
  323. !IFDEF NODEBUG
  324. ldebug = /RELEASE
  325. !ELSE
  326. !IFDEF PROFILE
  327. ldebug = -debug:mapped,partial -debugtype:coff
  328. !ELSE
  329. !IFDEF TUNE
  330. ldebug = -debug:mapped,partial -debugtype:coff
  331. !ELSE
  332. ldebug = -debug:full -debugtype:cv
  333. !ENDIF
  334. !ENDIF
  335. !ENDIF
  336.  
  337. # for compatibility with older-style makefiles
  338. linkdebug = $(ldebug)
  339.  
  340. # -------------------------------------------------------------------------
  341. # Subsystem Dependent Link Flags - must be specified after $(link)
  342. #
  343. # These switches allow for source level debugging with WinDebug for local
  344. # and global variables.  They also provide the standard application type and
  345. # entry point declarations.
  346. #
  347. # Note that on x86 screensavers have a WinMain entrypoint, but on RISC
  348. # platforms it is main.  This is a Win95 compatibility issue.
  349. #
  350. # -------------------------------------------------------------------------
  351.  
  352. # for Windows applications that use the C Run-Time libraries
  353. conlflags = $(lflags) -subsystem:console,$(APPVER)
  354. guilflags = $(lflags) -subsystem:windows,$(APPVER)
  355. dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll
  356.  
  357. !IF "$(CPU)" == "i386"
  358. savlflags = $(lflags) -subsystem:windows,$(APPVER) -entry:WinMainCRTStartup
  359. !ELSE
  360. savlflags = $(lflags) -subsystem:windows,$(APPVER) -entry:mainCRTStartup
  361. !ENDIF
  362.  
  363. # for POSIX applications
  364. psxlflags = $(lflags) -subsystem:posix -entry:__PosixProcessStartup
  365.  
  366. # for compatibility with older-style makefiles
  367. conflags  = $(conlflags)
  368. guiflags  = $(guilflags)
  369. psxflags  = $(psxlflags)
  370.  
  371. # -------------------------------------------------------------------------
  372. # C Run-Time Target Module Dependent Link Libraries
  373. #
  374. # Below is a table which describes which libraries to use depending on the
  375. # target module type, although the table specifically refers to Graphical
  376. # User Interface apps, the exact same dependencies apply to Console apps.
  377. # That is, you could replace all occurrences of 'GUI' with 'CON' in the
  378. # following:
  379. #
  380. # Desired CRT  Libraries   Desired CRT  Libraries
  381. #   Library     to link      Library     to link
  382. #   for EXE     with EXE     for DLL     with DLL
  383. # ----------------------------------------------------
  384. #   LIBC       GUILIBS       None       None       *
  385. #   LIBC       GUILIBS       LIBC       GUILIBS
  386. #   LIBC       GUILIBS       LIBCMT     GUILIBSMT
  387. #   LIBCMT     GUILIBSMT     None       None       *
  388. #   LIBCMT     GUILIBSMT     LIBC       GUILIBS
  389. #   LIBCMT     GUILIBSMT     LIBCMT     GUILIBSMT
  390. #   CRTDLL     GUILIBSDLL    None       None       *
  391. #   CRTDLL     GUILIBSDLL    LIBC       GUILIBS
  392. #   CRTDLL     GUILIBSDLL    LIBCMT     GUILIBSMT
  393. #   CRTDLL     GUILIBSDLL    CRTDLL     GUILIBSDLL *
  394. #
  395. # * - Recommended Configurations.
  396. #
  397. # Note: Any executable which accesses a DLL linked with CRTDLL.LIB must
  398. #       also link with CRTDLL.LIB instead of LIBC.LIB or LIBCMT.LIB.
  399. #
  400. # Note: For POSIX applications, link with $(psxlibs).
  401. #
  402. # -------------------------------------------------------------------------
  403.  
  404. # These CRT Libraries assume the use of Microsoft Visual C++.  If you are
  405. # using another Compiler product, change the libc* variable to correspond
  406. # to your import library names.
  407.  
  408. libc = libc.lib oldnames.lib
  409. libcmt = libcmt.lib oldnames.lib
  410. libcdll = msvcrt.lib oldnames.lib
  411.  
  412. # for POSIX applications
  413. psxlibs    = libcpsx.lib psxdll.lib psxrtl.lib oldnames.lib
  414.  
  415.  
  416. # optional profiling and tuning libraries
  417. !IFDEF PROFILE
  418. optlibs =  cap.lib
  419. !ELSE
  420. !IFDEF TUNE
  421. optlibs = wst.lib
  422. !ELSE
  423. optlibs =
  424. !ENDIF
  425. !ENDIF
  426.  
  427. # if building for Windows NT 4 or greater, switch over to WinSock2
  428. !IF "$(TARGETOS)" == "WINNT"
  429. !IF "$(APPVER)" != "3.51"
  430. winsocklibs = ws2_32.lib mswsock.lib
  431. !ELSE
  432. winsocklibs = wsock32.lib
  433. !ENDIF
  434. !ELSE
  435. winsocklibs = wsock32.lib
  436. !ENDIF
  437.  
  438.  
  439. # basic subsystem specific libraries, less the C Run-Time
  440. baselibs   = kernel32.lib $(optlibs) $(winsocklibs) advapi32.lib
  441. winlibs    = $(baselibs) user32.lib gdi32.lib comdlg32.lib winspool.lib
  442.  
  443. # for Windows applications that use the C Run-Time libraries
  444. conlibs    = $(libc) $(baselibs)
  445. conlibsmt  = $(libcmt) $(baselibs)
  446. conlibsdll = $(libcdll) $(baselibs)
  447. guilibs    = $(libc) $(winlibs)
  448. guilibsmt  = $(libcmt) $(winlibs)
  449. guilibsdll = $(libcdll) $(winlibs)
  450.  
  451. # for OLE applications
  452. olelibs      = ole32.lib uuid.lib oleaut32.lib $(guilibs)
  453. olelibsmt    = ole32.lib uuid.lib oleaut32.lib $(guilibsmt)
  454. olelibsdll   = ole32.lib uuid.lib oleaut32.lib $(guilibsdll)
  455.  
  456. # for backward compatibility
  457. ole2libs    = $(olelibs)
  458. ole2libsmt  = $(olelibsmt)
  459. ole2libsdll = $(olelibsdll)
  460.  
  461. #ENDIF _WIN32_MAK_
  462. !ENDIF 
  463.