forked from fancycode/MemoryModule
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
96 lines (76 loc) · 2.09 KB
/
Makefile
File metadata and controls
96 lines (76 loc) · 2.09 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
ifndef PLATFORM
PLATFORM = i686
endif
CC = $(PLATFORM)-w64-mingw32-g++
CXX = $(PLATFORM)-w64-mingw32-g++
LD = $(PLATFORM)-w64-mingw32-ld
RC = $(PLATFORM)-w64-mingw32-windres
else
CC = g++
CXX = g++
LD = ld
RC = rc
endif
RM = rm
CFLAGS = -Wall -g -DTESTSUITE
LDFLAGS =
RCFLAGS = -O coff
ifdef UNICODE
CFLAGS += -DUNICODE -D_UNICODE
endif
CFLAGS_DLL = -DSAMPLEDLL_EXPORTS
CFLAGS_EXE =
LDFLAGS_DLL = -shared
LDFLAGS_EXE = -static
TEST_DLLS = \
test-align-128.dll \
test-align-256.dll \
test-align-512.dll \
test-align-768.dll \
test-align-1024.dll \
test-align-2048.dll \
test-align-3072.dll \
test-align-4096.dll \
test-align-100.dll \
test-align-200.dll \
test-align-300.dll \
test-align-400.dll \
test-align-500.dll \
test-align-600.dll \
test-align-800.dll \
test-align-900.dll \
test-relocate.dll \
test-exports.dll
LOADDLL_OBJ = LoadDll.o ../MemoryModule.o
TESTSUITE_OBJ = TestSuite.o ../MemoryModule.o
DLL_OBJ = SampleDLL.o SampleDLL.res
all: prepare_testsuite LoadDll.exe TestSuite.exe $(TEST_DLLS)
prepare_testsuite:
rm -f $(TESTSUITE_OBJ)
LoadDll.exe: $(LOADDLL_OBJ)
$(CC) $(LDFLAGS_EXE) $(LDFLAGS) -Wl,--image-base -Wl,0x20000000 -o LoadDll.exe $(LOADDLL_OBJ)
TestSuite.exe: $(TESTSUITE_OBJ)
$(CC) $(LDFLAGS_EXE) $(LDFLAGS) -o TestSuite.exe $(TESTSUITE_OBJ)
LoadDll.o: LoadDll.cpp
$(CXX) $(CFLAGS) $(CFLAGS_EXE) -c $<
test-align-%.dll: $(DLL_OBJ)
$(LD) $(LDFLAGS_DLL) $(LDFLAGS) --file-alignment $* --section-alignment $* -o $@ $(DLL_OBJ)
test-relocate.dll: $(DLL_OBJ)
$(CXX) $(LDFLAGS_DLL) $(LDFLAGS) -Wl,--image-base -Wl,0x20000000 -o $@ $(DLL_OBJ)
test-exports.dll: SampleExports.o
$(CXX) $(LDFLAGS_DLL) $(LDFLAGS) -o $@ SampleExports.o
SampleExports.cpp: generate-exports.sh
./generate-exports.sh
%.o: %.cpp
$(CXX) $(CFLAGS) $(CFLAGS_DLL) -c $<
%.o: %.cc
$(CC) $(CFLAGS) $(CFLAGS_DLL) -c $<
%.res: %.rc
$(RC) $(RCFLAGS) -o $*.res $<
clean:
$(RM) -rf LoadDll.exe $(TEST_DLLS) $(LOADDLL_OBJ) $(DLL_OBJ) $(TESTSUITE_OBJ) SampleExports.o
test: all
./runwine.sh $(PLATFORM) TestSuite.exe
./runtests.sh $(PLATFORM) "$(TEST_DLLS)"