summaryrefslogtreecommitdiff
path: root/test/win.mak
blob: ed70b38146822e9a657f0b6e33062fa8301f1f91 (plain)
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
#
# File:                 win.mak
#
# Description:          Makefile for regression tests on Windows
#                       (can be built using platform SDK's buildfarm)
#
# Usage:                NMAKE /f win.mak [ installcheck ]
#
# Comments:             Created by Michael Paquier, 2014-05-21
#

ORIGDIR=.
# Include the list of tests
!INCLUDE tests

SRCDIR=$(ORIGDIR)\src
OBJDIR=exe
EXEDIR=exe

# The 'tests' file contains names of the test programs, in form
# exe/<testname>-test. Extract the base names of the tests, by stripping the
# "exe/" prefix and "-test" suffix. (It would seem more straightforward to do
# it the other way round, but it is surprisingly difficult to add a
# prefix/suffix to a list in nmake. Removing them is much easier.)
TESTS = $(TESTBINS:exe/=)
TESTS = $(TESTS:-test=)

# Now create names of the test .exe from the base names

# exe\<testname>.exe
TESTEXES = $(TESTBINS:-test=-test.exe)
TESTEXES = $(TESTEXES:/=\)

COMSRC = $(SRCDIR)\common.c
COMOBJ = $(OBJDIR)\common.obj

# Flags
CLFLAGS=/W3 /D WIN32 /D _CRT_SECURE_NO_DEPRECATE
LINKFLAGS=/link odbc32.lib odbccp32.lib /MANIFEST:EMBED

# Build an executable for each test.
#
{$(SRCDIR)\}.c{$(EXEDIR)\}.exe:
	$(CC) /Fe.\$(EXEDIR)\ /Fo.\$(OBJDIR)\ $< $(COMOBJ) $(CLFLAGS) $(LINKFLAGS)

all: $(TESTEXES) runsuite.exe

$(TESTEXES): $(OBJDIR) $(COMOBJ)

$(COMOBJ): $(COMSRC)
	$(CC) $(CLFLAGS) /c $? /Fo$@

$(OBJDIR) :
!IF !EXIST($(OBJDIR))
	mkdir $(OBJDIR)
!ENDIF
!IF !EXIST($(EXEDIR)) && "$(EXEDIR)" != "$(OBJDIR)"
	mkdir "$(EXEDIR)"
!ENDIF


runsuite.exe: $(ORIGDIR)\runsuite.c
	$(CC) $** $(CLFLAGS) $(LINKFLAGS)

reset-db.exe: $(ORIGDIR)\reset-db.c $(COMOBJ)
	$(CC) $** $(CLFLAGS) $(LINKFLAGS)

# activate the above inference rule
.SUFFIXES: .out

# Run regression tests
RESDIR=results
installcheck: runsuite.exe $(TESTEXES) reset-db.exe
	del regression.diffs
	.\reset-db < $(ORIGDIR)\sampletables.sql
!IF !EXIST($(RESDIR))
	mkdir $(RESDIR)
!ENDIF
        .\runsuite $(TESTS) --inputdir=$(ORIGDIR)

clean:
	-del $(EXEDIR)\*.exe
	-del $(OBJDIR)\*.obj