Skip to content
This repository was archived by the owner on Nov 25, 2019. It is now read-only.

Commit eca08ba

Browse files
committed
Improve Makefile
1 parent 3a39989 commit eca08ba

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

Makefile

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,34 @@
1-
CC=g++
2-
SOURCES=./src/qqq.cpp
3-
EXECUTABLE=./bin/qqq
1+
OS := $(shell uname)
2+
ifneq (,$(findstring MINGW,$(OS)))
3+
OS := Windows
4+
else ifneq(,$(findstring MSYS,$(OS)))
5+
OS := Windows
6+
else ifneq(,$(findstring CYGWIN,$(OS)))
7+
OS := Windows
8+
endif # Cygwin
9+
endif # MSys
10+
endif # MinGW
411

5-
all:
6-
$(CC) $(SOURCES) -o $(EXECUTABLE) -Wall -O0
12+
ifneq (,$(findstring $(OS),Darwin FreeBSD))
13+
CXX := clang++
14+
else
15+
CXX := g++
16+
endif
17+
18+
ifeq ($(OS),Windows)
19+
EXE := bin/qqq.exe
20+
else
21+
EXE := bin/qqq
22+
endif
23+
24+
setup:
25+
-mkdir bin
26+
27+
cpp: setup
28+
$(CXX) cpp/qqq.cpp -o $(EXE) -Wall -O0
29+
30+
rust: setup
31+
rustc rust/main.rs -o $(EXE)
732

833
clean:
9-
rm $(EXECUTABLE)
34+
-rm $(EXECUTABLE)

bin/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)