-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathMakefile.msvc
57 lines (43 loc) · 1.88 KB
/
Makefile.msvc
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
# This variant of Makefile is specific for MSVC on Windows and should be processed with nmake.exe
# this file is for general settings such as file list, etc.
# machine-specific settings such as include paths and #defines are in Makefile.local
include Makefile.local
# this file is shared between Makefile (Linux/MacOS) and Makefile.msvc (Windows)
# and contains the list of source files and folders
include Makefile.list
LIBNAME_SHARED = agama.pyd
LIBNAME_STATIC = agama.lib
OBJECTS = $(SOURCES:.cpp=.obj)
OBJECTS = obj/$(OBJECTS: = obj/)
TORUSOBJ= $(TORUSSRC:.cc=.obj)
TORUSOBJ= obj/$(TORUSOBJ: = obj/)
TESTEXE = $(TESTSRCS:.cpp=.exe)
TESTEXE = exe/$(TESTEXE: = exe/)
COMPILE_FLAGS_ALL = $(COMPILE_FLAGS_ALL) -I$(SRCDIR)
# this is the default target (build all), if make is launched without parameters
all: $(OBJDIR) $(EXEDIR) lib $(TESTEXE)
# one may recompile just the library by running 'make lib'
lib: $(LIBNAME_STATIC) $(LIBNAME_SHARED)
$(LIBNAME_STATIC): $(OBJECTS) $(TORUSOBJ) Makefile Makefile.local Makefile.list
lib.exe $(OBJECTS) $(TORUSOBJ) /out:$(LIBNAME_STATIC)
$(LIBNAME_SHARED): $(OBJECTS) $(TORUSOBJ) Makefile Makefile.local Makefile.list
link.exe $(OBJECTS) $(TORUSOBJ) $(LINK_FLAGS_ALL) $(LINK_FLAGS_LIB) $(LINK_FLAGS_LIB_AND_EXE_STATIC) /dll /out:$(LIBNAME_SHARED) /implib:agama_pyd.lib
del agama_pyd.lib
del agama_pyd.exp
$(TESTEXE): $(LIBNAME_STATIC) Makefile.local
{src}.cpp{obj}.obj:
$(CC) $(COMPILE_FLAGS_ALL) $(COMPILE_FLAGS_LIB) -c $< -Foobj/
{src/torus}.cc{obj}.obj:
$(CC) $(COMPILE_FLAGS_ALL) $(COMPILE_FLAGS_LIB) -c $< -Foobj/
{tests}.cpp{exe}.exe:
$(CC) -Fe: "$@" -Foobj/tmp.obj "$<" $(COMPILE_FLAGS_ALL) /link $(LINK_FLAGS_LIB_AND_EXE_STATIC) $(LIBNAME_STATIC)
$(OBJDIR):
mkdir $(OBJDIR)
$(EXEDIR):
mkdir $(EXEDIR)
# run tests (both C++ and python)
test:
cd py
python alltest.py
clean:
del $(OBJDIR)\*.obj $(EXEDIR)\*.exe $(LIBNAME_SHARED) $(LIBNAME_STATIC)