Advertisement
Guest User

WIN32.MAK

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