1 # Makefile for Windows NT. Assumes Microsoft compiler.
2 # Should be invoked as "nmake -f NT_MAKEFILE [<args>]"; the optional arguments
3 # are: "cpu=AMD64" - to target x64, "cpu=i386" - to target x86,
4 # "make_as_lib=1" - to build it as a static library, "nodebug=1" - to produce
5 # the release variant of the library, "nothreads=1" - to build the library and
6 # the tests without threads support.
12 !IF !DEFINED(CPU) || "$(CPU)" == ""
13 CPU = $(PROCESSOR_ARCHITECTURE)
15 !IF "$(CPU)" == "I386" || "$(CPU)" == "X86" || "$(CPU)" == "x86"
17 !ELSEIF "$(CPU)" == "X64" || "$(CPU)" == "x64" || "$(CPU)" == "amd64"
21 !IF !DEFINED(NMAKE_WINVER)
25 cflags = $(cflags) -c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -GS -D_WINNT -W4
26 !IF "$(CPU)" == "i386"
27 cflags = $(cflags) -D_X86_=1 -DWIN32 -D_WIN32
28 !ELSEIF "$(CPU)" == "AMD64"
29 cflags = $(cflags) -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32
31 cflags = $(cflags) -D_WIN32_WINNT=$(NMAKE_WINVER) -DWINVER=$(NMAKE_WINVER)
36 rcvars = -DWIN32 -D_WIN32 -DWINVER=$(NMAKE_WINVER)
40 cdebug = -Zi -Od -DDEBUG
41 rcvars = -DWIN32 -D_WIN32 -DWINVER=$(NMAKE_WINVER) -DDEBUG -D_DEBUG
42 ldebug = /DEBUG /DEBUGTYPE:cv
45 !IF "$(CPU)" == "i386"
47 !ELSEIF "$(CPU)" == "AMD64"
52 CFLAGS_DEBUG=-DGC_ASSERTIONS
56 CFLAGS_MT=$(cvarsmt) -DGC_THREADS -DTHREAD_LOCAL_ALLOC -DPARALLEL_MARK
60 CFLAGS_GCDLL=-DGC_NOT_DLL
61 LINK_GC=lib /out:gc.lib
64 LINK_DLL_FLAGS=kernel32.lib user32.lib /subsystem:windows /dll \
65 /INCREMENTAL:NO /pdb:"gc.pdb" /out:gc.dll /implib:gc.lib
66 LINK_GC=$(link) $(ldebug) $(LINK_DLL_FLAGS)
69 CFLAGS_SPECIFIC=$(CFLAGS_DEBUG) $(CFLAGS_GCDLL) $(CFLAGS_MT)
71 CFLAGS_DEFAULT=-DALL_INTERIOR_POINTERS -DENABLE_DISCLAIM -DGC_ATOMIC_UNCOLLECTABLE -DGC_GCJ_SUPPORT -DJAVA_FINALIZATION -DNO_EXECUTE_PERMISSION -DUSE_MUNMAP
73 # Make sure that .cc is not viewed as a suffix. It is for VC++2005, but
74 # not earlier versions. We can deal with either, but not inconsistency.
76 .SUFFIXES: .obj .cpp .c
78 # Atomic_ops installation directory. For win32, the source directory
79 # should do, since we only need the headers.
80 # We assume this was manually unpacked.
81 AO_SRC_DIR=libatomic_ops/src
82 AO_INCLUDE_DIR=$(AO_SRC_DIR)
84 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
88 check: gctest.exe test_cpp.exe de.exe
93 $(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
94 # Disable crt security warnings, since unfortunately they warn about all sorts
95 # of safe uses of strncpy. It would be nice to leave the rest enabled.
98 $(cc) $(cdebug) $(cflags) $(CFLAGS_SPECIFIC) -Iinclude $(CFLAGS_DEFAULT) -D_CRT_SECURE_NO_DEPRECATE $*.cpp /Fo$*.obj
100 $(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
103 $(LINK_GC) /MACHINE:$(CPU) $(OBJS)
105 gctest.exe: gc.lib tests\test.obj
106 $(link) /MACHINE:$(CPU) /INCREMENTAL:NO $(ldebug) $(lflags) user32.lib -out:$*.exe tests\test.obj gc.lib
107 # mapsympe -n -o gctest.sym gctest.exe
108 # This produces a GUI app that opens no window and writes to gctest.gc.log.
110 cord\tests\de_win.rbj: cord\tests\de_win.res
111 cvtres /MACHINE:$(CVTRES_CPU) /OUT:cord\tests\de_win.rbj cord\tests\de_win.res
113 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
115 cord\tests\de_win.res: cord\tests\de_win.rc cord\tests\de_win.h cord\tests\de_cmds.h
116 $(rc) $(rcvars) -r -fo cord\tests\de_win.res cord\tests\de_win.rc
118 # Cord/de is a real win32 GUI app.
119 de.exe: cord\cordbscs.obj cord\cordxtra.obj cord\tests\de.obj cord\tests\de_win.obj cord\tests\de_win.rbj gc.lib
120 $(link) /MACHINE:$(CPU) /INCREMENTAL:NO $(ldebug) $(lflags) -out: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
122 gc_cpp.obj: gc_cpp.cc include\gc_cpp.h include\gc.h
124 test_cpp.cpp: tests\test_cpp.cc
125 copy tests\test_cpp.cc test_cpp.cpp
127 # This generates the C++ test executable. The executable expects
128 # a single numeric argument, which is the number of iterations.
129 # The output appears in test_cpp.gc.log file.
130 test_cpp.exe: test_cpp.obj include\gc_cpp.h include\gc.h gc.lib
131 $(link) /MACHINE:$(CPU) /INCREMENTAL:NO $(ldebug) $(lflags) user32.lib -out:test_cpp.exe test_cpp.obj gc.lib
134 tar xvfz $(AO_SRC_DIR).tar.gz
137 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