-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
31 lines (24 loc) · 821 Bytes
/
Makefile
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
# ©2017-2022 YUICHIRO NAKADA
PROGRAM = $(patsubst %.c,%,$(wildcard *.c))
ifneq (, $(shell which clang))
CC = clang
endif
ifneq (, $(shell which icc))
CC = icc
endif
CFLAGS = -Os -ffunction-sections -fdata-sections -funroll-loops -finline-functions -ftree-vectorize
#CFLAGS = -Os -ffunction-sections -fdata-sections -funroll-loops -finline-functions -ftree-vectorize -march=native
LDFLAGS = -lasound -lm -Wl,-s -Wl,--gc-sections
#LDFLAGS = -lasound -lm -Wl,-s -Wl,-dead_strip
.PHONY: all
all: depend $(PROGRAM)
%.o : %.c $(HEAD)
$(CC) $(LDFLAGS) $(CFLAGS) -c $(@F:.o=.c) -o $@
.PHONY: clean
clean:
$(RM) $(PROGRAM) $(OBJS) _depend.inc
.PHONY: depend
depend: $(OBJS:.o=.c)
-@ $(RM) _depend.inc
-@ for i in $^; do cpp -MM $$i | sed "s/\ [_a-zA-Z0-9][_a-zA-Z0-9]*\.c//g" >> _depend.inc; done
-include _depend.inc