-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest
More file actions
57 lines (44 loc) · 1.43 KB
/
test
File metadata and controls
57 lines (44 loc) · 1.43 KB
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
57
# Convention : Les fichiers de suffixe .c
# - ne contiennent pas pas de main() sauf mini_shell.c
#
# Exemples de compilation :
# make
# make OPT=n
# make ETU=y
#
# Exemples d'exécution :
# bin-gcc/mon_executable
# bin-clang/mon_executable
ifeq ($(OPT),n)
OPTFLAGS=-O0
else
OPTFLAGS=-Os
endif
DEFINES = -D_GNU_SOURCE # for get_current_dir_name()
ifeq ($(ETU),y)
DEFINES += -DETUDIANTS
endif
compilo-gcc = gcc $(OPTFLAGS) -g -std=gnu11 -Wall -W -Werror
compilo-clang = clang-3.9 $(OPTFLAGS) -g -std=gnu11 -Weverything -Werror -Wno-missing-noreturn -Wno-padded -Wno-disabled-macro-expansion -fcaret-diagnostics
executables = mini_shell
executables-gcc = $(foreach exe,$(executables),bin-gcc/$(exe))
executables-clang = $(foreach exe,$(executables),bin-clang/$(exe))
headers = $(wildcard *.hpp)
objets = $(patsubst %.c,%.o, $(wildcard *.c))
objets-gcc = $(foreach obj,$(objets),bin-gcc/$(obj))
objets-clang = $(foreach obj,$(objets),bin-clang/$(obj))
default: $(executables-gcc)
$(executables-gcc): %: %.o $(objets-gcc)
@make --no-print-directory $(subst bin-gcc,bin-clang,$@)
$(compilo-gcc) $^ -o $@
$(executables-clang): %: %.o $(objets-clang)
$(compilo-clang) $^ -o $@
bin-gcc/%.o: %.c $(headers)
@mkdir -p bin-gcc
@make --no-print-directory $(subst bin-gcc,bin-clang,$@)
$(compilo-gcc) $(DEFINES) -c $< -o $@
bin-clang/%.o: %.c $(headers)
@mkdir -p bin-clang
$(compilo-clang) $(DEFINES) -c $< -o $@
menage:
rm -rf *~ bin* a.out core