-
Notifications
You must be signed in to change notification settings - Fork 1
/
NT_MAKEFILE
141 lines (112 loc) · 5.34 KB
/
NT_MAKEFILE
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Makefile for Windows NT. Assumes Microsoft compiler.
# Should be invoked as "nmake -f NT_MAKEFILE [<args>]"; the optional arguments
# are: "cpu=AMD64" - to target x64, "cpu=i386" - to target x86,
# "make_as_lib=1" - to build it as a static library, "nodebug=1" - to produce
# the release variant of the library, "nothreads=1" - to build the library and
# the tests without threads support.
cc = cl
link = link
rc = rc
!IF !DEFINED(CPU) || "$(CPU)" == ""
CPU = $(PROCESSOR_ARCHITECTURE)
!ENDIF
!IF "$(CPU)" == "I386" || "$(CPU)" == "X86" || "$(CPU)" == "x86"
CPU = i386
!ELSEIF "$(CPU)" == "X64" || "$(CPU)" == "x64" || "$(CPU)" == "amd64"
CPU = AMD64
!ENDIF
!IF !DEFINED(NMAKE_WINVER)
NMAKE_WINVER = 0x0600
!ENDIF
cflags = $(cflags) -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -GS -D_WINNT -W4
!IF "$(CPU)" == "i386"
cflags = $(cflags) -D_X86_=1 -DWIN32 -D_WIN32
!ELSEIF "$(CPU)" == "AMD64"
cflags = $(cflags) -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32
!ENDIF
cflags = $(cflags) -D_WIN32_WINNT=$(NMAKE_WINVER) -DWINVER=$(NMAKE_WINVER)
!IFDEF NODEBUG
cvarsmt = -D_MT -MT
cdebug = -Ox -DNDEBUG
rcvars = -DWIN32 -D_WIN32 -DWINVER=$(NMAKE_WINVER)
ldebug = /RELEASE
!ELSE
cvarsmt = -D_MT -MTd
cdebug = -Zi -Od -DDEBUG
rcvars = -DWIN32 -D_WIN32 -DWINVER=$(NMAKE_WINVER) -DDEBUG -D_DEBUG
ldebug = /DEBUG /DEBUGTYPE:cv
!ENDIF
!IF "$(CPU)" == "i386"
CVTRES_CPU=X86
!ELSEIF "$(CPU)" == "AMD64"
CVTRES_CPU=X64
!ENDIF
!IFNDEF NODEBUG
CFLAGS_DEBUG=-DGC_ASSERTIONS
!ENDIF
!IFNDEF NOTHREADS
CFLAGS_MT=$(cvarsmt) -DGC_THREADS -DTHREAD_LOCAL_ALLOC -DPARALLEL_MARK
!ENDIF
!IFDEF MAKE_AS_LIB
CFLAGS_GCDLL=-DGC_NOT_DLL
GC_LIB=gc.lib
LINK_GC=lib /out:$(GC_LIB)
!ELSE
CFLAGS_GCDLL=-DGC_DLL
!IF "$(CPU)" == "AMD64"
GC_DLL=gc64.dll
GC_LIB=gc64_dll.lib
!ELSE
GC_DLL=gc.dll
GC_LIB=gc_dll.lib
!ENDIF
LINK_DLL_FLAGS=kernel32.lib user32.lib /subsystem:windows /dll \
/INCREMENTAL:NO /pdb:"gc.pdb" /out:$(GC_DLL) /implib:$(GC_LIB)
LINK_GC=$(link) $(ldebug) $(LINK_DLL_FLAGS)
!ENDIF
CFLAGS_SPECIFIC=$(CFLAGS_DEBUG) $(CFLAGS_GCDLL) $(CFLAGS_MT)
CFLAGS_DEFAULT=-DALL_INTERIOR_POINTERS -DENABLE_DISCLAIM -DGC_ATOMIC_UNCOLLECTABLE -DGC_GCJ_SUPPORT -DJAVA_FINALIZATION -DNO_EXECUTE_PERMISSION -DUSE_MUNMAP
# Make sure that .cc is not viewed as a suffix. It is for VC++2005, but
# not earlier versions. We can deal with either, but not inconsistency.
.SUFFIXES:
.SUFFIXES: .obj .cpp .c
# Atomic_ops installation directory. For win32, the source directory
# should do, since we only need the headers.
# We assume this was manually unpacked.
AO_SRC_DIR=libatomic_ops/src
AO_INCLUDE_DIR=$(AO_SRC_DIR)
OBJS= misc.obj win32_threads.obj alloc.obj reclaim.obj allchblk.obj mach_dep.obj os_dep.obj mark_rts.obj headers.obj mark.obj obj_map.obj blacklst.obj finalize.obj new_hblk.obj dbg_mlc.obj fnlz_mlc.obj malloc.obj dyn_load.obj typd_mlc.obj ptr_chck.obj gc_cpp.obj gcj_mlc.obj mallocx.obj extra\msvc_dbg.obj thread_local_alloc.obj
all: gctest.exe cord\de.exe test_cpp.exe
.c.obj:
$(cc) $(cdebug) $(cflags) $(CFLAGS_SPECIFIC) -Iinclude -I$(AO_INCLUDE_DIR) $(CFLAGS_DEFAULT) -DCORD_NOT_DLL -D_CRT_SECURE_NO_DEPRECATE $*.c /Fo$*.obj /wd4100 /wd4127 /wd4701
# Disable crt security warnings, since unfortunately they warn about all sorts
# of safe uses of strncpy. It would be nice to leave the rest enabled.
.cpp.obj:
$(cc) $(cdebug) $(cflags) $(CFLAGS_SPECIFIC) -Iinclude $(CFLAGS_DEFAULT) -D_CRT_SECURE_NO_DEPRECATE $*.cpp /Fo$*.obj
$(OBJS) tests\test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h include\private\gc_locks.h include\private\gc_pmark.h include\gc_mark.h include\gc_disclaim.h include\private\msvc_dbg.h
$(GC_LIB): $(OBJS)
$(LINK_GC) /MACHINE:$(CPU) $(OBJS)
gctest.exe: $(GC_LIB) tests\test.obj
$(link) /MACHINE:$(CPU) /INCREMENTAL:NO $(ldebug) $(lflags) user32.lib -out:$*.exe tests\test.obj $(GC_LIB)
# mapsympe -n -o gctest.sym gctest.exe
# This produces a GUI app that opens no window and writes to gctest.gc.log.
cord\tests\de_win.rbj: cord\tests\de_win.res
cvtres /MACHINE:$(CVTRES_CPU) /OUT:cord\tests\de_win.rbj cord\tests\de_win.res
cord\tests\de.obj cord\tests\de_win.obj: include\cord.h include\cord_pos.h cord\tests\de_win.h cord\tests\de_cmds.h
cord\tests\de_win.res: cord\tests\de_win.rc cord\tests\de_win.h cord\tests\de_cmds.h
$(rc) $(rcvars) -r -fo cord\tests\de_win.res cord\tests\de_win.rc
# Cord/de is a real win32 GUI app.
cord\de.exe: cord\cordbscs.obj cord\cordxtra.obj cord\tests\de.obj cord\tests\de_win.obj cord\tests\de_win.rbj $(GC_LIB)
$(link) /MACHINE:$(CPU) /INCREMENTAL:NO $(ldebug) $(lflags) -out:cord\de.exe cord\cordbscs.obj cord\cordxtra.obj cord\tests\de.obj cord\tests\de_win.obj cord\tests\de_win.rbj $(GC_LIB) gdi32.lib user32.lib
gc_cpp.obj: gc_cpp.cc include\gc_cpp.h include\gc.h
test_cpp.cpp: tests\test_cpp.cc
copy tests\test_cpp.cc test_cpp.cpp
# This generates the C++ test executable. The executable expects
# a single numeric argument, which is the number of iterations.
# The output appears in test_cpp.gc.log file.
test_cpp.exe: test_cpp.obj include\gc_cpp.h include\gc.h $(GC_LIB)
$(link) /MACHINE:$(CPU) /INCREMENTAL:NO $(ldebug) $(lflags) user32.lib -out:test_cpp.exe test_cpp.obj $(GC_LIB)
$(AO_SRC_DIR):
tar xvfz $(AO_SRC_DIR).tar.gz
clean:
del *.exe *.log *.obj *.pdb cord\*.exe cord\*.exp cord\*.lib cord\*.obj cord\*.pdb cord\tests\*.rbj cord\tests\*.res cord\tests\*.obj extra\*.obj gc*.lib gc*.dll gc*.exp test_cpp.cpp tests\*.obj 2> nul