Improve NetBSD support: Allow VMA determination with fewer system calls.
[libsigsegv/ericb.git] / Makefile.msvc
bloba2f501684d5f02d17137fd68a37575c140ebeb92
1 # -*- Makefile -*- for libsigsegv
3 #### Start of system configuration section. ####
5 # Flags that can be set on the nmake command line:
6 #   MFLAGS={-ML|-MT|-MD} for defining the compilation model
7 #     MFLAGS=-ML (the default)  Single-threaded, statically linked - libc.lib
8 #     MFLAGS=-MT                Multi-threaded, statically linked  - libcmt.lib
9 #     MFLAGS=-MD                Multi-threaded, dynamically linked - msvcrt.lib
10 #   DEBUG=1   for compiling with debugging information
11 # Note that nmake command line flags are automatically passed to subdirectory
12 # Makefiles. Therefore we don't need to pass them explicitly to subdirectory
13 # Makefiles, but the subdirectory Makefiles need to have the same defaults.
14 # Building as a DLL not supported yet.
15 DLL=0
16 !if !defined(DEBUG)
17 DEBUG=0
18 !endif
19 !if !defined(MFLAGS)
20 !if !$(DLL)
21 MFLAGS=
22 !else
23 MFLAGS=-MD
24 !endif
25 !endif
27 !if $(DEBUG)
28 OPTIMFLAGS = -Od -Z7
29 !else
30 OPTIMFLAGS = -D_NDEBUG -O1
31 !endif
33 # Directories used by "make":
34 srcdir = .
36 # Directories used by "make install":
37 prefix = /usr/local
38 local_prefix = /usr/local
39 exec_prefix = $(prefix)
40 libdir = $(exec_prefix)/lib
41 includedir = $(prefix)/include
43 # Programs used by "make":
44 CC = cl
45 CFLAGS = $(MFLAGS) $(OPTIMFLAGS)
46 CPP = cl -E
47 INCLUDES = -I. -I$(srcdir)
48 AR = lib
49 AR_FLAGS = /out:
50 MV = ren
51 CP = copy
52 LN = copy
53 RM = -del
55 # Programs used by "make install":
56 INSTALL = @INSTALL@
57 INSTALL_PROGRAM = @INSTALL_PROGRAM@
58 INSTALL_DATA = @INSTALL_DATA@
60 #### End of system configuration section. ####
62 SHELL = /bin/sh
64 OBJECTS = handler.obj dispatcher.obj version.obj
66 all : sigsegv.lib
68 config.h : config.h.msvc
69         $(CP) $(srcdir)\config.h.msvc config.h
71 sigsegv.h : src/sigsegv.h.msvc
72         $(CP) $(srcdir)\src\sigsegv.h.msvc sigsegv.h
74 handler.obj : $(srcdir)/src/handler.c $(srcdir)/src/handler-win32.c sigsegv.h config.h
75         $(CC) $(CFLAGS) $(INCLUDES) -c $(srcdir)/src/handler.c
77 dispatcher.obj : $(srcdir)/src/dispatcher.c sigsegv.h config.h
78         $(CC) $(CFLAGS) $(INCLUDES) -c $(srcdir)/src/dispatcher.c
80 version.obj : $(srcdir)/src/version.c sigsegv.h
81         $(CC) $(CFLAGS) $(INCLUDES) -c $(srcdir)/src/version.c
83 !if !$(DLL)
84 sigsegv.lib : $(OBJECTS)
85         $(RM) sigsegv.lib
86         $(AR) $(AR_FLAGS)sigsegv.lib $(OBJECTS)
87 !else
88 # sigsegv.dll and sigsegv.lib are created together.
89 sigsegv.lib : $(OBJECTS)
90         $(CC) $(MFLAGS) -LD $(OBJECTS) -Fesigsegv.dll
91 !endif
93 sigsegv1.exe : $(srcdir)/tests/sigsegv1.c sigsegv.h sigsegv.lib
94         $(CC) $(CFLAGS) $(INCLUDES) $(srcdir)/tests/sigsegv1.c sigsegv.lib /Fesigsegv1
96 sigsegv2.exe : $(srcdir)/tests/sigsegv2.c sigsegv.h sigsegv.lib
97         $(CC) $(CFLAGS) $(INCLUDES) $(srcdir)/tests/sigsegv2.c sigsegv.lib /Fesigsegv2
99 stackoverflow1.exe : $(srcdir)/tests/stackoverflow1.c sigsegv.h sigsegv.lib
100         $(CC) $(CFLAGS) $(INCLUDES) $(srcdir)/tests/stackoverflow1.c sigsegv.lib /Festackoverflow1
102 stackoverflow2.exe : $(srcdir)/tests/stackoverflow2.c sigsegv.h sigsegv.lib
103         $(CC) $(CFLAGS) $(INCLUDES) $(srcdir)/tests/stackoverflow2.c sigsegv.lib /Festackoverflow2
105 check : all sigsegv1.exe sigsegv2.exe stackoverflow1.exe stackoverflow2.exe
106         sigsegv1.exe
107         sigsegv2.exe
108         stackoverflow1.exe
109         stackoverflow2.exe
111 mostlyclean : clean
113 clean : force
114         $(RM) sigsegv.h *.obj *.lib *.exp *.dll core
115         $(RM) sigsegv1.exe sigsegv2.exe stackoverflow1.exe stackoverflow2.exe
117 distclean : clean
118         $(RM) config.status config.log config.cache Makefile config.h
120 maintainer-clean : distclean
122 force :