forked from pclewis/lslint
-
Notifications
You must be signed in to change notification settings - Fork 13
/
NMakefile
90 lines (72 loc) · 2.92 KB
/
NMakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
VERSION_NUMBER = $(BUILD_VERSION_NUMBER)
BUILD_DATE = $(BUILD_DATE)
#
# 1. Download "Win flex-bison" and unpack it
# http://sourceforge.net/projects/winflexbison/
#
# 2. Open "VS2015 x64 Native Tools Command Prompt" or other SDK shell prompt.
# You need the windows 7.0 SDK or later.
# For Windows XP compatible binaries, the windows 7.0 or 7.1 SDK is required.
#
# 3. Add 1. unpacked directory to PATH. VERSION_NUMBER and BUILD_DATE are also required.
#
# 4. Run "nmake /F NMakefile" to build or "nmake /F NMakefile debug=1" to build debuggable binary.
#
# 5. Run "nmake clean /F NMakefile" to cleanup.
#
# NOTE: builtins.txt should be converted beforehand. Run the following on any terminal emulator (f.g. MinGW)
#
# echo "#ifdef _MSC_VER" > builtins_txt.cc
# echo "#pragma execution_character_set(\"utf-8\")" >> builtins_txt.cc
# echo "#endif" >> builtins_txt.cc
# echo "const char *builtins_txt[] = {" >> builtins_txt.cc
# sed -e '/^\/\//d; s/"/\\\"/g; s/^/"/; s/$/",/' builtins.txt >> builtins_txt.cc || { rm -f builtins_txt.cc ; false ; }
# echo "(char*)0 };" >> builtins_txt.cc
!IFNDEF DEBUG
NODEBUG=1
!ENDIF
# Uncomment this line to build on windows 7 or older SDK
# WINXP=1
!IFDEF WINXP
# This file is probably optional since my fallback, but it doesn't hurt to leave support for it
!include <win32.mak>
!ELSE
#############################################################
# Replacement for win32.mak by Xenhat
!IFNDEF NODEBUG
cdebug = -Ox -DNDEBUG
cvars = -D_MT -MD
!ELSE
cvars = -D_MT -MT
!ENDIF
cflags = -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS
conlflags = /INCREMENTAL:NO /NOLOGO -subsystem:console,$(EXEVER)
cc = cl.exe
link = link.exe
##############################################################
!ENDIF
!IFDEF NODEBUG
VERSION = $(VERSION_NUMBER)
OPT_VARS = /TP /D_MBCS /DYY_NO_UNISTD_H /EHsc /utf-8
!ELSE
VERSION = $(VERSION_NUMBER)debug
OPT_VARS = /TP /D_MBCS /DYY_NO_UNISTD_H /EHsc /Fd$*.pdb /utf-8
!ENDIF
LEX = win_flex
YACC = win_bison
OBJS = lslmini.tab.obj lex.yy.obj lslmini.obj symtab.obj builtins.obj builtins_txt.obj types.obj values.obj final_walk.obj operators.obj logger.obj
start: all
lex.yy.o:
$(LEX) lslmini.l
lslmini.tab.o:
$(YACC) -d -v lslmini.y
.c.obj:
$(cc) $(cdebug) $(cflags) $(cvars) $(OPT_VARS) /w $*.c
lslmini.obj:
$(cc) $(cdebug) $(cflags) $(cvars) $(OPT_VARS) /DVERSION="""$(VERSION)""" /DBUILD_DATE="""$(BUILD_DATE)""" $*.cc
symtab.obj builtins.obj builtins_txt.obj types.obj values.obj final_walk.obj operators.obj logger.obj:
$(cc) $(cdebug) $(cflags) $(cvars) $(OPT_VARS) $*.cc
all: lex.yy.o lslmini.tab.o $(OBJS)
$(link) $(ldebug) $(conflags) -out:lslint.exe $(OBJS) kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
clean:
del -f *.pdb *.idb lex.yy.c lslmini.tab.c lslmini.tab.h $(OBJS) lslmini.output lslint.exe