forked from cirosantilli/cpp-cheat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
33 lines (24 loc) · 642 Bytes
/
Makefile
File metadata and controls
33 lines (24 loc) · 642 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
.POSIX:
COMMON_FLAGS = -O'$O' -g'$(G)' -pthread -Wextra
CFLAGS = $(COMMON_FLAGS) -std=c99
CXXFLAGS = $(COMMON_FLAGS) -std=c++11
G = gdb3
IN_EXT = .c
IN_EXT_CPP = .cpp
O = 0
OUT_EXT = .out
RUN = count_infinite
INS = $(wildcard *$(IN_EXT))
OUTS = $(addsuffix $(OUT_EXT), $(basename $(INS)))
INS_CPP = $(wildcard *$(IN_EXT_CPP))
OUTS_CPP = $(addsuffix $(OUT_EXT), $(basename $(INS_CPP)))
.PHONY: all clean run
all: $(OUTS) $(OUTS_CPP)
%$(OUT_EXT): %$(IN_EXT)
gcc $(CFLAGS) -o '$@' -pedantic-errors '$<'
%$(OUT_EXT): %$(IN_EXT_CPP)
g++ $(CXXFLAGS) -o '$@' -pedantic-errors '$<'
clean:
rm -f *$(OUT_EXT)
run: all
./'$(RUN)$(OUT_EXT)'