-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
46 lines (35 loc) · 938 Bytes
/
makefile
File metadata and controls
46 lines (35 loc) · 938 Bytes
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
CC = clang++
CXXFLAGS = -I./$(INCL) -g -Wall -Wextra -Wpedantic -std=c++20
OFLAG ?= O1
FILE = main
MAIN ?= src/$(FILE).cc
BIN = $(FILE)
IMPL_DIR = src/impl
IMPL_FILES := $$(find $(IMPL_DIR) -name '*.cc' | xargs)
INCL := src/include/
MKDIRS = /bin/bash -c 'if [ ! -d bin/ ]; then mkdir bin/; fi; if [ ! -d dbg/ ]; then mkdir dbg/; fi'
REPLACE_FILES = /bin/bash -c 'if [ -d dbg/$(BIN).dSYM/ ]; then rm -r dbg/$(BIN).dSYM/; fi; if [ -d bin/$(BIN).dSYM/ ]; then mv bin/$(BIN).dSYM/ dbg//; fi'
CXXCPFX = $(CC) $(MAIN) $(IMPL_FILES) -o bin/$(BIN) $(CXXFLAGS)
default: $(MAIN)
$(MKDIRS)
$(CXXCPFX) -$(OFLAG)
$(REPLACE_FILES)
fast:
$(MKDIRS)
$(CXXCPFX) -Ofast
$(REPLACE_FILES)
debug:
$(MKDIRS)
$(CXXCPFX) -Og
$(REPLACE_FILES)
size:
$(MKDIRS)
$(CXXCPFX) -Os
$(REPLACE_FILES)
verbose: $(MAIN)
$(MKDIRS)
$(CXXCPFX) -$(OFLAG) -v
$(REPLACE_FILES)
clean: bin/$(BIN) bin/$(BIN).dSYM/
rm bin/$(BIN)
rm -r bin/$(BIN).dSYM/