Home | History | Annotate | Line # | Download | only in windows
      1 ########################################################################
      2 #
      3 # Copyright (c) 2021, PADL Software Pty Ltd.
      4 # All rights reserved.
      5 #
      6 # Redistribution and use in source and binary forms, with or without
      7 # modification, are permitted provided that the following conditions
      8 # are met:
      9 #
     10 # - Redistributions of source code must retain the above copyright
     11 #   notice, this list of conditions and the following disclaimer.
     12 #
     13 # - Redistributions in binary form must reproduce the above copyright
     14 #   notice, this list of conditions and the following disclaimer in
     15 #   the documentation and/or other materials provided with the
     16 #   distribution.
     17 #
     18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
     21 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
     22 # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
     23 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     24 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     25 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
     26 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
     28 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN if ADVISED OF THE
     29 # POSSIBILITY OF SUCH DAMAGE.
     30 #
     31 
     32 !if !defined(CPU) || "$(CPU)" == ""
     33 CPU         =AMD64
     34 !endif
     35 
     36 !if "$(CPU)" == "X86" || "$(CPU)" == "x86"
     37 CPU         =i386
     38 !endif
     39 
     40 !if !defined(APPVER)
     41 APPVER      =6.1
     42 !endif
     43 
     44 !if "$(APPVER)" == "5.0"
     45 NMAKE_WINVER=0x0500
     46 !elseif "$(APPVER)" == "5.01"
     47 NMAKE_WINVER=0x0501
     48 !elseif "$(APPVER)" == "5.02"
     49 NMAKE_WINVER=0x0502
     50 !elseif "$(APPVER)" == "6.0"
     51 NMAKE_WINVER=0x0600
     52 !elseif "$(APPVER)" == "6.1"
     53 NMAKE_WINVER=0x0601
     54 !elseif "$(APPVER)" == "10.0"
     55 NMAKE_WINVER=0x0A00
     56 !endif
     57 
     58 cc          = cl
     59 link        = link
     60 implib      = lib
     61 
     62 cflags      = -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -W4
     63 
     64 !if "$(CPU)" == "i386"
     65 cflags      = $(cflags) -D_X86_=1
     66 !endif
     67 !if "$(CPU)" == "AMD64"
     68 cflags      = $(cflags) -D_AMD64_=1
     69 !endif
     70 !if "$(CPU)" == "ARM"
     71 cflags      = $(cflags) -D_ARM_=1
     72 !endif
     73 !if "$(CPU)" == "ARM64"
     74 cflags      = $(cflags) -D_ARM64_=1
     75 !endif
     76 
     77 cflags      = $(cflags) -DWIN32 -D_WIN32
     78 !if "$(CPU)" == "AMD64" || "$(CPU)" == "ARM64"
     79 cflags      = $(cflags) -DWIN64 -D_WIN64
     80 !endif
     81 
     82 cflags      = $(cflags) -D_WINNT -D_WIN32_WINNT=$(NMAKE_WINVER)
     83 cflags      = $(cflags) -DNTDDI_VERSION=$(NMAKE_WINVER)0000
     84 cflags      = $(cflags) -D_WIN32_IE=$(NMAKE_WINVER) -DWINVER=$(NMAKE_WINVER)
     85 
     86 !ifdef NODEBUG
     87 cdebug      = -Ox -DNDEBUG
     88 !else
     89 cdebug      = -Zi -Od -DDEBUG
     90 !endif
     91 
     92 cvarsmt     = -D_MT
     93 cvarsdll    = -D_MT -D_DLL
     94 !ifdef NODEBUG
     95 cvarsmt     = $(cvarsmt) -MTd
     96 cvarsdll    = $(cvarsdll) -MDd
     97 !else
     98 cvarsmt     = $(cvarsmt) -MT
     99 cvarsdll    = $(cvarsdll) -MD
    100 !endif
    101 cvars       = $(cvarsmt)
    102 
    103 lflags      = $(lflags) /INCREMENTAL:NO /NOLOGO
    104 !ifdef NODEBUG
    105 ldebug      = /RELEASE
    106 !else
    107 ldebug      = /DEBUG /DEBUGTYPE:cv
    108 !endif
    109 
    110 !if "$(CPU)" == "i386"
    111 dllentry    = _DllMainCRTStartup@12
    112 !else
    113 dllentry    = _DllMainCRTStartup
    114 !endif
    115 
    116 conlflags   = $(lflags) -subsystem:console,$(APPVER)
    117 guilflags   = $(lflags) -subsystem:windows,$(APPVER)
    118 dlllflags   = $(lflags) -entry:$(dllentry) -dll
    119 
    120 baselibs    = kernel32.lib ws2_32.lib mswsock.lib advapi32.lib
    121 conlibs     = $(baselibs)
    122 conlibsmt   = $(baselibs)
    123 conlibsdll  = $(baselibs)
    124 
    125 winlibs     = $(baselibs) user32.lib gdi32.lib comdlg32.lib winspool.lib
    126 guilibs     = $(winlibs)
    127 guilibsmt   = $(winlibs)
    128 guilibsdll  = $(winlibs)
    129