-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.vc
63 lines (54 loc) · 1.15 KB
/
Makefile.vc
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
#
# Windows NMAKE makefile for nopf
#
#
# Defines files and directory names
#
EXECUTABLE_NAME = nopf.exe
DIR_SRC = src
BUILD_TYPE = release
!if "$(BUILD_TYPE)" == "release"
DIR_BIN = _bin.release
DIR_OBJ = _obj.release
CFLAGS = /O2 /Ot
LINKFLAGS =
!else if "$(BUILD_TYPE)" == "debug"
DIR_BIN = _bin.debug
DIR_OBJ = _obj.debug
CFLAGS = /Zi /D_DEBUG /Fd$(DIR_OBJ)/
LINKFLAGS = /DEBUG:FASTLINK
!else
! error "BUILD_TYPE must be 'release' or 'debug'"
!endif
#
# Transform source to object files
#
{$(DIR_SRC)}.c{$(DIR_OBJ)}.obj:
@echo Compiling release build...
$(CC) $(CFLAGS) /c /Fo$(DIR_OBJ)\ $<
#
# Transform object files to executable
#
$(EXECUTABLE_NAME) : $(DIR_OBJ)\*.obj
@echo Linking release build...
link $(LINKFLAGS) /out:$(DIR_BIN)\$(EXECUTABLE_NAME) $(DIR_OBJ)\*.obj
#
# Build release application
#
nopf: $(EXECUTABLE_NAME)
#
# Create output directories
#
create_dirs:
@if not exist $(DIR_OBJ) mkdir $(DIR_OBJ)
@if not exist $(DIR_BIN) mkdir $(DIR_BIN)
#
# Delete output directories
#
clean:
@if exist $(DIR_OBJ) rmdir /Q /S $(DIR_OBJ)
@if exist $(DIR_BIN) rmdir /Q /S $(DIR_BIN)
#
# Target 'all' for a full rebuild
#
all: clean create_dirs nopf