-
Notifications
You must be signed in to change notification settings - Fork 0
/
NMAKEFILE
96 lines (75 loc) · 2.21 KB
/
NMAKEFILE
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
EXECUTABLE = program.exe
###################################
SOURCE_DIR = src
OBJECT_DIR = build
BINARY_DIR = bin
EXTERN_DIR = ext
###################################
INCLUDE_DIRS =
LIBRARIES =
DLLS =
EXTRA_OBJS =
###################################
CC = icl
LINK = link
###################################
# Set compiler flags for MSVC or Intel C++,
# responds to the value of the $(CC) variable.
###################################
!IF "$(CC)" == "cl"
EXTRA_FLAGS = /Ox
!ENDIF
!IF "$(CC)" == "icl"
EXTRA_FLAGS = /Wextra /Wpedantic /Qdiag-disable:remark /O3 /arch=SSSE3 \
/D__builtin_huge_val()=HUGE_VAL \
/D__builtin_huge_valf()=HUGE_VALF \
/D__builtin_nan=nan \
/D__builtin_nanf=nanf \
/D__builtin_nans=nan \
/D__builtin_nansf=nanf
!ENDIF
CFLAGS = /EHsc /Wall $(EXTRA_FLAGS) /c /Fo.\$(OBJECT_DIR)\ $(_INCLUDE_DIRS)
###################################
# Insert /I flags for include directories
###################################
!IF "$(INCLUDE_DIRS)" != ""
__INCLUDE_DIRS = $(INCLUDE_DIRS: = )
_INCLUDE_DIRS = /I $(__INCLUDE_DIRS: = /I )
!ENDIF
###################################
# Build source paths
###################################
C_SOURCES_1 = *.c
CPP_SOURCES_1 = *.cpp
C_SOURCES_2 = $(SOURCE_DIR)\$(C_SOURCES_1: = src\)
CPP_SOURCES_2 = $(SOURCE_DIR)\$(CPP_SOURCES_1: = src\)
SOURCES = $(C_SOURCES_2) $(CPP_SOURCES_2)
###################################
# Build object paths
###################################
C_OBJECTS_1 = $(OBJECT_DIR)\$(C_SOURCES_1: = build\)
CPP_OBJECTS_1 = $(OBJECT_DIR)\$(CPP_SOURCES_1: = build\)
C_OBJECTS_2 = $(C_OBJECTS_1:.c=.obj)
CPP_OBJECTS_2 = $(CPP_OBJECTS_1:.cpp=.obj)
OBJECTS = $(C_OBJECTS_2) $(CPP_OBJECTS_2) $(EXTRA_OBJS)
###################################
BINARY = $(BINARY_DIR)\$(EXECUTABLE)
all: $(BINARY) $(OBJECTS) binary_dir
echo_inc:
echo $(_INCLUDE_DIRS)
echo_libs:
echo $(LIBRARIES)
echo_objects:
echo $(OBJECTS)
echo_sources:
echo $(SOURCES)
$(BINARY): $(OBJECTS)
$(LINK) $(OBJECT_DIR)\*.obj $(LIBRARIES) /OUT:$(BINARY)
binary_dir: $(DLLS)
for %n in ($**) do copy /y /v /b %n $(BINARY_DIR)
{$(SOURCE_DIR)}.cpp{$(OBJECT_DIR)}.obj::
$(CC) $(CFLAGS) $<
{$(SOURCE_DIR)}.c{$(OBJECT_DIR)}.obj::
$(CC) $(CFLAGS) $<
clean:
del $(OBJECT_DIR)\*.obj $(BINARY_DIR)\*.dll $(BINARY_DIR)\*.exe