-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
57 lines (43 loc) · 917 Bytes
/
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
CC=g++-9
ACC=arm-linux-gnueabi-g++
SRCDIR=src
TSTDIR=test
DBGDIR=debug
RELDIR=release
ANDDIR=android
LIBDIR=$(SRCDIR)/lib
INCDIR=$(SRCDIR)/include
BIN=strlen
ANDBIN=$(BIN).arm
SRCNAM=main
SRCEXT=cpp
SRC=$(SRCNAM).$(SRCEXT)
SRCPTH=$(SRCDIR)/$(SRC)
TSTPTH=$(TSTDIR)/$(BIN)
DBGPTH=$(DBGDIR)/$(BIN)
RELPTH=$(RELDIR)/$(BIN)
ANDPTH=$(ANDDIR)/$(ANDBIN)
CF_DBG=-g -Wall -Wextra -std=c++17
CF_REL=-O2 -std=c++17
CF_AND=$(CF_REL) -static -march=armv8-a
TSTARG=
$(SRCNAM): $(SRCPTH)
mkdir -p $(RELDIR)
$(CC) $(CF_REL) $(SRCPTH) -o $(RELPTH)
android: $(SRCPTH)
mkdir -p $(ANDDIR)
$(ACC) $(CF_AND) $(SRCPTH) -o $(ANDPTH)
debug:
mkdir -p $(DBGDIR)
$(CC) $(CF_DBG) $(SRCPTH) -o $(DBGPTH)
test:
mkdir -p $(TSTDIR)
$(CC) $(CF_DBG) $(SRCPTH) -o $(TSTPTH)
./$(TSTPTH) $(TSTARG)
install: $(SRCNAM)
cp -f "$(RELPTH)" "/usr/bin/$(BIN)"
clean:
rm -rf $(RELDIR)
rm -rf $(TSTDIR)
rm -rf $(DBGDIR)
rm -rf $(ANDDIR)