blob: 259e0a67f06b2101b9ad22323ef9403e5a389838 (
plain)
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
|
CC1=clang++
CC2=g++
CFLAGS_CLANG=-O0 -Wfatal-errors -Wall -Werror -Wextra -g3 -fsanitize=address,leak,undefined,float-divide-by-zero -Wpedantic -Wformat=2 -Wshadow -fno-common -std=c++20
CFLAGS_GCC=-O0 -Wfatal-errors -Wall -Werror -Wextra -g3 -fsanitize=address,leak,undefined,float-divide-by-zero -Wpedantic -Wformat=2 -Wshadow -fno-common -std=c++20 -Wformat-truncation=2 -Wformat-overflow
BINDIR=bin
SRCS=$(wildcard *.cpp)
OBJS_CLANG=$(patsubst %.cpp, $(BINDIR)/clang/%, $(SRCS))
OBJS_GCC=$(patsubst %.cpp, $(BINDIR)/gcc/%, $(SRCS))
MAKEFLAGS += -j$(nproc)
all: clang gcc ch6e9
clean:
rm -rf $(BINDIR)/gcc/*
rm -rf $(BINDIR)/clang/*
clang: $(OBJS_CLANG)
gcc: $(OBJS_GCC)
$(BINDIR)/clang/%: %.cpp
@mkdir -p $(BINDIR)/clang
$(CC1) $(CFLAGS_CLANG) -o $@ $<
$(BINDIR)/gcc/%: %.cpp
@mkdir -p $(BINDIR)/gcc
$(CC2) $(CFLAGS_GCC) -o $@ $<
ch6e9: $(BINDIR)/clang/FACT $(BINDIR)/gcc/FACT
$(BINDIR)/clang/FACT: fact.o factMain.o
@mkdir -p $(BINDIR)/clang
$(CC1) $(CFLAGS_CLANG) factMain.o fact.o -o $(BINDIR)/clang/FACT
$(BINDIR)/gcc/FACT: fact.o factMain.o
@mkdir -p $(BINDIR)/gcc
$(CC2) $(CFLAGS_GCC) factMain.o fact.o -o $(BINDIR)/gcc/FACT
fact.o: fact.cc
$(CC2) $(CFLAGS_GCC) -c fact.cc
factMain.o: factMain.cc
$(CC2) $(CFLAGS_GCC) -c factMain.cc
.PHONY: all clean clang gcc
|