forked from ivmai/bdwgc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NT_MAKEFILE
192 lines (146 loc) · 7.05 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# Makefile for Windows (Win32/64). 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,
# "enable_static=1" - to build it as a static library, "nodebug=1" - to produce
# the release variant of the library, "disable_threads=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
!IFDEF ENABLE_STATIC
CFLAGS_GCDLL=-DGC_NOT_DLL
CORDFLAG=
!ELSE
CFLAGS_GCDLL=-DGC_DLL
# cord.dll and its clients should not link C library statically otherwise
# FILE-related functions might not work (because own set of opened FILEs
# is maintained by each copy of the C library thus making impossible to pass
# FILE pointer from .exe code to .dll code).
cvarsmt=
!IFDEF NODEBUG
CORDFLAG=-MD
!ELSE
CORDFLAG=-MDd
!ENDIF
!ENDIF
!IFNDEF DISABLE_THREADS
CFLAGS_MT=$(cvarsmt) -DGC_THREADS -DTHREAD_LOCAL_ALLOC -DPARALLEL_MARK
!ENDIF
# Extra user-defined flags to pass both to C and C++ compilers.
CFLAGS_EXTRA=
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 -DGC_REQUIRE_WCSDUP -DUSE_MUNMAP
CXXFLAGS_SPECIFIC=/EHsc
# 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)
!IFDEF ENABLE_STATIC
# pthread_start.obj is needed just in case client defines GC_WIN32_PTHREADS.
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 gcj_mlc.obj mallocx.obj extra\msvc_dbg.obj pthread_start.obj pthread_support.obj thread_local_alloc.obj
!ELSE
OBJS= extra\gc.obj extra\msvc_dbg.obj
!ENDIF
COBJS= cord\cordbscs.obj cord\cordxtra.obj cord\cordprnt.obj
all: gc.lib cord.lib gccpp.lib gctba.lib
check-deps: gctest.exe cpptest.exe cordtest.exe de.exe
check: check-deps
gctest.exe
cordtest.exe
cpptest.exe
.c.obj:
$(cc) $(cdebug) $(cflags) $(CFLAGS_SPECIFIC) $(CORDFLAG) -Iinclude -I$(AO_INCLUDE_DIR) $(CFLAGS_DEFAULT) -D_CRT_SECURE_NO_DEPRECATE $(CFLAGS_EXTRA) $*.c /Fo$*.obj /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) $(CXXFLAGS_SPECIFIC) -D_CRT_SECURE_NO_DEPRECATE $(CFLAGS_EXTRA) $*.cpp /Fo$*.obj
$(OBJS) tests\gctest.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\gc_mark.h include\gc\gc_disclaim.h
!IFDEF ENABLE_STATIC
gc.lib: $(OBJS)
lib /out:gc.lib /MACHINE:$(CPU) $(OBJS)
cord.lib: $(COBJS)
lib /out:cord.lib /MACHINE:$(CPU) $(COBJS)
gccpp.lib: gc_badalc.obj gc_cpp.obj
lib /out:gccpp.lib /MACHINE:$(CPU) gc_badalc.obj gc_cpp.obj
# The same as gccpp.lib but contains only gc_badalc.obj.
gctba.lib: gc_badalc.obj
lib /out:gctba.lib /MACHINE:$(CPU) gc_badalc.obj
!ELSE
gc.lib: $(OBJS)
$(link) $(ldebug) kernel32.lib user32.lib /subsystem:windows /dll /INCREMENTAL:NO /pdb:"gc.pdb" /out:gc.dll /implib:gc.lib /MACHINE:$(CPU) $(OBJS)
cord.lib: $(COBJS) gc.lib
$(link) $(ldebug) gc.lib /subsystem:windows /dll /INCREMENTAL:NO /pdb:"cord.pdb" /out:cord.dll /implib:cord.lib /MACHINE:$(CPU) $(COBJS)
gccpp.lib: gc_badalc.obj gc_cpp.obj gc.lib
$(link) $(ldebug) gc.lib /subsystem:windows /dll /INCREMENTAL:NO /pdb:"gccpp.pdb" /out:gccpp.dll /implib:gccpp.lib /MACHINE:$(CPU) gc_badalc.obj gc_cpp.obj
gctba.lib: gc_badalc.obj gc.lib
$(link) $(ldebug) gc.lib /subsystem:windows /dll /INCREMENTAL:NO /pdb:"gctba.pdb" /out:gctba.dll /implib:gctba.lib /MACHINE:$(CPU) gc_badalc.obj
!ENDIF
gctest.exe: gc.lib tests\gctest.obj
$(link) /MACHINE:$(CPU) /INCREMENTAL:NO $(ldebug) $(lflags) user32.lib -out:$*.exe tests\gctest.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\gc\cord.h include\gc\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 Windows GUI app.
de.exe: cord\tests\de.obj cord\tests\de_win.obj cord\tests\de_win.rbj gc.lib cord.lib
$(link) /MACHINE:$(CPU) /INCREMENTAL:NO $(ldebug) $(lflags) -out:de.exe cord\tests\de.obj cord\tests\de_win.obj cord\tests\de_win.rbj gc.lib cord.lib gdi32.lib user32.lib
cordtest.exe: cord\tests\cordtest.obj gc.lib cord.lib
$(link) /subsystem:console /MACHINE:$(CPU) /INCREMENTAL:NO $(ldebug) $(lflags) -out:cordtest.exe cord\tests\cordtest.obj gc.lib cord.lib user32.lib
gc_badalc.obj: gc_badalc.cc include\gc_cpp.h include\gc.h
gc_cpp.obj: gc_cpp.cc include\gc_cpp.h include\gc.h
test_cpp.cpp: tests\cpp.cc
copy tests\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 cpptest.gc.log file.
cpptest.exe: test_cpp.obj include\gc_cpp.h include\gc.h gc.lib gccpp.lib
$(link) /MACHINE:$(CPU) /INCREMENTAL:NO $(ldebug) $(lflags) user32.lib -out:cpptest.exe test_cpp.obj gc.lib gccpp.lib
$(AO_SRC_DIR):
tar xvfz $(AO_SRC_DIR).tar.gz
clean:
del *.dll *.exe *.exp *.lib *.log *.obj *.pdb cordtst*.tmp cord\*.obj cord\tests\*.rbj cord\tests\*.res cord\tests\*.obj extra\*.obj test_cpp.cpp tests\*.obj 2> nul