1# Makefile for Windows NT.  Assumes Microsoft compiler.
2# DLLs are included in the root set under NT, but not under win32S.
3# Use "nmake nodebug=1 all" for optimized versions of library, gctest and editor.
4
5MY_CPU=AMD64
6CPU=$(MY_CPU)
7!include <ntwin32.mak>
8
9# Make sure that .cc is not viewed as a suffix.  It is for VC++2005, but
10# not earlier versions.  We can deal with either, but not inconsistency.
11.SUFFIXES:
12.SUFFIXES: .obj .cpp .c
13
14# Atomic_ops installation directory.  For win32, the source directory
15# should do, since we only need the headers.
16# We assume this was manually unpacked, since I'm not sure there is
17# a Windows standard command line tool to do this.
18AO_VERSION=1.2
19AO_SRC_DIR=libatomic_ops-$(AO_VERSION)/src
20AO_INCLUDE_DIR=$(AO_SRC_DIR)
21
22OBJS= alloc.obj reclaim.obj allchblk.obj misc.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 malloc.obj stubborn.obj dyn_load.obj typd_mlc.obj ptr_chck.obj gc_cpp.obj mallocx.obj win32_threads.obj msvc_dbg.obj thread_local_alloc.obj
23
24all: gctest.exe cord\de.exe test_cpp.exe
25
26.c.obj:
27	$(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -D__STDC__ -DGC_NOT_DLL -DGC_WIN32_THREADS -DTHREAD_LOCAL_ALLOC $*.c /Fo$*.obj /wd4701 -D_CRT_SECURE_NO_DEPRECATE
28# Disable "may not be initialized" warnings.  They're too approximate.
29# Disable crt security warnings, since unfortunately they warn about all sorts
30# of safe uses of strncpy.  It would be nice to leave the rest enabled.
31
32.cpp.obj:
33	$(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -DGC_NOT_DLL $*.CPP -DGC_WIN32_THREADS -DTHREAD_LOCAL_ALLOC /Fo$*.obj -D_CRT_SECURE_NO_DEPRECATE
34
35$(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\private\msvc_dbg.h
36
37gc.lib: $(OBJS)
38	lib /MACHINE:X64 /out:gc.lib $(OBJS)
39
40gctest.exe: tests\test.obj gc.lib
41#  This produces a "GUI" applications that opens no windows and writes to the log file
42#  "gc.log".  This was done to make the result runnable under win32s and
43#  should be fixed.
44	$(link) $(ldebug) $(guiflags) -stack:131072 -out:$*.exe tests\test.obj $(guilibs) gc.lib
45
46cord\de_win.rbj: cord\de_win.res
47	cvtres /MACHINE:$(MY_CPU) /OUT:cord\de_win.rbj cord\de_win.res
48
49cord\de.obj cord\de_win.obj: include\cord.h include\private\cord_pos.h cord\de_win.h cord\de_cmds.h
50
51cord\de_win.res: cord\de_win.rc cord\de_win.h cord\de_cmds.h
52	$(rc) $(rcvars) -r -fo cord\de_win.res cord\de_win.rc
53
54# Cord/de is a real win32 gui application.
55cord\de.exe: cord\cordbscs.obj cord\cordxtra.obj cord\de.obj cord\de_win.obj cord\de_win.rbj gc.lib
56	$(link) $(ldebug) $(guiflags) -stack:16384 -out:cord\de.exe  cord\cordbscs.obj cord\cordxtra.obj cord\de.obj cord\de_win.obj cord\de_win.rbj gc.lib $(guilibs)
57
58gc_cpp.obj: include\gc_cpp.h include\gc.h
59
60gc_cpp.cpp: gc_cpp.cc
61	copy gc_cpp.cc gc_cpp.cpp
62
63test_cpp.cpp: tests\test_cpp.cc
64	copy tests\test_cpp.cc test_cpp.cpp
65
66# This generates the C++ test executable.  The executable expects
67# a single numeric argument, which is the number of iterations.
68# The output appears in the file "gc.log".
69test_cpp.exe: test_cpp.obj include\gc_cpp.h include\gc.h gc.lib
70	$(link) $(ldebug) $(guiflags) -stack:16384 -out:test_cpp.exe test_cpp.obj gc.lib $(guilibs)
71
72AO_SCR_DIR:
73	        tar xvfz $(AO_SRC_DIR).tar.gz;
74
75