-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
76 lines (63 loc) · 2.05 KB
/
Makefile
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
##############
## Settings ##
##############
EXECUTABLE_NAME=ScottyCPU
BIN=bin
BLOG=build_log.txt
RESOURCES=$(BIN)\ScottyResources_res.o
##############
## Build ##
##############
.PHONY: build clean
build: debug
@echo Build successful!
test:
@echo Running build...
@IF EXIST "$(BIN)\$(EXECUTABLE_NAME).exe" ( \
$(BIN)\$(EXECUTABLE_NAME).exe -d \
) else ( \
@echo No build present. Run debug or release first. \
)
debug: prepare prepare-resources
@echo Compiling debug...
$(CXX) -pthread -std=c++0x -Wall -Wextra main.cpp -o $(BIN)/$(EXECUTABLE_NAME) $(RESOURCES) > $(BIN)/$(BLOG)
$(MAKE) cleanup
@echo Build successful!
debug-extra: prepare
@echo Compiling debug with extra's...
$(CXX) -m32 -g -fno-inline -fno-omit-frame-pointer -pthread -std=c++0x -Wall -Wextra main.cpp -o $(BIN)/$(EXECUTABLE_NAME) > $(BIN)/$(BLOG)
$(MAKE) cleanup
@echo Build successful!
release: prepare prepare-resources
@echo Compiling release...
$(CXX) -pthread -std=c++0x -Wall -Wextra -O2 -s main.cpp -o $(BIN)/$(EXECUTABLE_NAME) $(RESOURCES) > $(BIN)/$(BLOG)
$(MAKE) cleanup
@echo Build successful!
debug_VS2013: prepare
@RC /nologo ScottyResources.rc
@echo Compiling release...
$(CXX) -Wall main.cpp -o $(BIN)/$(EXECUTABLE_NAME) ScottyResources.res > $(BIN)/$(BLOG)
$(MAKE) cleanup
@echo Build successful!
release_VS2013: prepare
@RC /nologo ScottyResources.rc
@echo Compiling release...
$(CXX) -Wall -O2 main.cpp -o $(BIN)/$(EXECUTABLE_NAME) ScottyResources.res > $(BIN)/$(BLOG)
$(MAKE) cleanup
@echo Build successful!
clean:
@echo Delete bin folder...
@IF EXIST "$(BIN)" @del /f /s /q $(BIN) 1>nul
@IF EXIST "$(BIN)" @rmdir /S /Q $(BIN)
@IF EXIST "$(BIN)" @rmdir /S /Q $(BIN)
cleanup:
@IF EXIST "$(RESOURCES)" @del $(RESOURCES)
@IF EXIST "main.obj" @del main.obj
@IF EXIST "ScottyResources.res" @del ScottyResources.res
create_directories:
@echo Create bin folder...
@IF NOT EXIST "$(BIN)" @mkdir $(BIN)
prepare: clean create_directories
prepare-resources:
@echo Compile $(RESOURCES)...
@windres -i ScottyResources.rc -o $(RESOURCES) --include-dir=.