-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (60 loc) · 2.3 KB
/
Makefile
File metadata and controls
69 lines (60 loc) · 2.3 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
58
59
60
61
62
63
64
65
66
67
68
69
CC?= clang
TRASH= $(if $(shell command -v trash),trash,rm)
CFLAGS= \
-Wall \
-Wextra \
-Wpedantic \
-std=c89 \
-Wint-conversion \
-Wimplicit-fallthrough \
-Wshadow \
-Wcast-qual \
-Wconversion \
-Wdouble-promotion \
-Wfloat-equal \
-Wformat=2 \
-Wno-format-nonliteral \
-Winit-self \
-Wstrict-prototypes \
-Wswitch-default \
-Wswitch-enum \
-Wundef \
-Wunused-macros \
-Wwrite-strings \
-Wcast-align \
-Wunreachable-code \
-Wpointer-arith \
-Wnull-dereference \
-g \
-fstack-protector-all \
-fstack-check \
-fsanitize=address,undefined \
-fsanitize-address-use-after-scope \
-ftrapv \
-rdynamic
ifeq ($(shell uname -m),x86_64)
CFLAGS += -mshstk
endif
all: run
run: example
./example
example: example.c core.h
$(CC) $(CFLAGS) example.c -o example
clean: $(dSYM)
if [ -e example ]; then $(TRASH) example; fi
if [ -e strip_prefix ]; then $(TRASH) strip_prefix; fi
if [ -e strip_prefix.dSYM ]; then $(TRASH) strip_prefix.dSYM; fi
if [ -e autogenerated.c ]; then $(TRASH) autogenerated.c; fi
if [ -e autogenerated.o ]; then $(TRASH) autogenerated.o; fi
if [ -e build ]; then $(TRASH) build; fi
if [ -e stage_1 ]; then $(TRASH) stage_1; fi
if [ -e a.out ]; then $(TRASH) a.out; fi
if [ -e TAGS ]; then $(TRASH) TAGS; fi
if [ -e example.dSYM ]; then $(TRASH) example.dSYM; fi
if [ -e stage_1.dSYM ]; then $(TRASH) stage_1.dSYM; fi
TAGS:
etags *.c *.h -o TAGS
.PHONY: clean run all strip_prefix
strip_prefix: strip_prefix.c Makefile core.h
$(CC) $(CFLAGS) strip_prefix.c -o strip_prefix
./strip_prefix