File ffcall/trampoline/Makefile.msvc artifact dea78eed5e part of check-in 4b31034008


# -*- Makefile -*- for trampoline

#### Start of system configuration section. ####

# Flags that can be set on the nmake command line:
#   MFLAGS={-ML|-MT|-MD} for defining the compilation model
#     MFLAGS=-ML (the default)  Single-threaded, statically linked - libc.lib
#     MFLAGS=-MT                Multi-threaded, statically linked  - libcmt.lib
#     MFLAGS=-MD                Multi-threaded, dynamically linked - msvcrt.lib
#   DEBUG=1   for compiling with debugging information
# Note that nmake command line flags are automatically passed to subdirectory
# Makefiles. Therefore we don't need to pass them explicitly to subdirectory
# Makefiles, but the subdirectory Makefiles need to have the same defaults.
# Building as a DLL not supported yet.
DLL=0
!if !defined(DEBUG)
DEBUG=0
!endif
!if !defined(MFLAGS)
!if !$(DLL)
MFLAGS=
!else
MFLAGS=-MD
!endif
!endif

!if $(DEBUG)
OPTIMFLAGS = -Od -Z7
!else
OPTIMFLAGS = -D_NDEBUG -O1
!endif

HOST = i386-pc-win32-msvc
CPU = i386

# Directories used by "make":
srcdir = .

# Directories used by "make install":
prefix = /usr/local
local_prefix = /usr/local
exec_prefix = $(prefix)
libdir = $(exec_prefix)/lib
includedir = $(prefix)/include
mandir = $(prefix)/man

# Programs used by "make":
CC = cl
CFLAGS = $(MFLAGS) $(OPTIMFLAGS)
CPP = cl -E
INCLUDES = -I. -I$(srcdir)
AR = lib
AR_FLAGS = /out:
RM = -del
LN = copy

# Programs used by "make install":
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@

#### End of system configuration section. ####

SHELL = /bin/sh

OBJECTS = trampoline.obj

all : $(OBJECTS) trampoline.lib trampoline.h $(srcdir)/trampoline.3 $(srcdir)/trampoline.html

trampoline.h : $(srcdir)/trampoline.h.in
	-$(LN) $(srcdir)\trampoline.h.in trampoline.h

config.h : $(srcdir)/config.h.msvc
	-$(LN) $(srcdir)\config.h.msvc config.h

trampoline.obj : $(srcdir)/trampoline.c trampoline.h config.h
	$(CC) $(CFLAGS) $(INCLUDES) -c $(srcdir)/trampoline.c

trampoline.s : $(srcdir)/trampoline.c trampoline.h config.h
	$(CC) $(CFLAGS) $(INCLUDES) -c $(srcdir)/trampoline.c /FAs /Fatrampoline.s

!if !$(DLL)
trampoline.lib : $(OBJECTS)
	$(RM) trampoline.lib
	$(AR) $(AR_FLAGS)trampoline.lib $(OBJECTS)
!else
# trampoline.dll and trampoline.lib are created together.
trampoline.lib : $(OBJECTS)
	$(CC) $(MFLAGS) -LD $(OBJECTS)
!endif

test1.obj : $(srcdir)/test1.c trampoline.h
	$(CC) $(CFLAGS) $(INCLUDES) -c $(srcdir)/test1.c

test1.exe : test1.obj $(OBJECTS)
	$(RM) test1.ilk
	$(CC) $(CFLAGS) test1.obj $(OBJECTS) /Fetest1.exe

test2.obj : $(srcdir)/test2.c trampoline.h
	$(CC) $(CFLAGS) $(INCLUDES) -c $(srcdir)/test2.c

test2.exe : test2.obj $(OBJECTS)
	$(RM) test2.ilk
	$(CC) $(CFLAGS) test2.obj $(OBJECTS) /Fetest2.exe

check1 : all test1.exe
	test1.exe

check : all test1.exe test2.exe
	test1.exe
	test2.exe
	copy nul tests.passed.$(HOST)

mostlyclean : clean

clean : force
	$(RM) $(OBJECTS) trampoline.lib trampoline.exp trampoline.dll core
	$(RM) test1.obj test1.exe test2.obj test2.exe

distclean : clean
	$(RM) config.status config.log config.cache Makefile config.h trampoline.h tests.passed.*

maintainer-clean : distclean

force :