-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
48 lines (30 loc) · 1.3 KB
/
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
CC = gcc
# Note: we use -std=gnu11 rather than -std=c11 in order to use the
# sigjmp_buf data type
CFLAGS = -no-pie -g -Wall -Wextra -pedantic -std=gnu11
ASMFLAGS = -no-pie -g
LDFLAGS = -no-pie
EXES = c_textsearch asm_textsearch c_textsearch_fns_tests asm_textsearch_fns_tests
%.o : %.c
$(CC) $(CFLAGS) -c $*.c -o $*.o
%.o : %.S
$(CC) $(ASMFLAGS) -c $*.S -o $*.o
all : $(EXES)
# targets for executables
c_textsearch : c_textsearch_fns.o c_textsearch.o
$(CC) $(LDFLAGS) -o $@ c_textsearch_fns.o c_textsearch.o
c_textsearch_fns_tests : c_textsearch_fns.o textsearch_fns_tests.o tctest.o
$(CC) $(LDFLAGS) -o $@ c_textsearch_fns.o textsearch_fns_tests.o tctest.o
asm_textsearch : asm_textsearch_fns.o asm_textsearch.o
$(CC) $(LDFLAGS) -o $@ asm_textsearch_fns.o asm_textsearch.o
asm_textsearch_fns_tests : asm_textsearch_fns.o textsearch_fns_tests.o tctest.o
$(CC) $(LDFLAGS) -o $@ asm_textsearch_fns.o textsearch_fns_tests.o tctest.o
# targets for object files
c_textsearch_fns.o : c_textsearch_fns.c textsearch_fns.h
c_textsearch.o : c_textsearch.c textsearch_fns.h tctest.h
asm_textsearch_fns.o : asm_textsearch_fns.S
asm_textsearch.o : asm_textsearch.S
tctest.o : tctest.c tctest.h
textsearch_fns_tests.o : textsearch_fns_tests.c textsearch_fns.h tctest.h
clean :
rm -f c_textsearch c_textsearch_fns_tests *.o