forked from rozuur/string_match
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (38 loc) · 823 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
CFLAGS = -I. -Wall -g
LDFLAGS =
LIBS =
ifeq ($(OSTYPE),linux)
EXE =
else
EXE = .exe
endif
PRJECT_NAME=string_match
all: $(PRJECT_NAME)$(EXE)
CC=gcc
.c.o:
@echo [CC]: $<
@$(CC) $(CFLAGS) -c $< -o $@
%.out:
@echo [OUT]: $^
@$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
%.exe:
@echo [EXE]: $^
@$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(sources) $(LIBS)
%.a:
@echo [AR]: $@
@ar rcs $@ $^
%.d: %.c
@echo [DEP]: $<
@$(SHELL) -ec '$(CC) -MM -MQ $*.o $(CFLAGS) $< > $@'
sources = string_util.c brute_force.c rabin_karp.c string_match.c
ifneq ($(MAKECMDGOALS),mrproper)
ifneq ($(MAKECMDGOALS),clean)
-include $(sources:.c=.d)
endif
endif
$(PRJECT_NAME)$(EXE): $(sources:.c=.o)
.PHONY: clean mrproper
clean:
rm -f *.o *.out, *$(EXE)
mrproper: clean
rm -f *.d