-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
55 lines (42 loc) · 1.23 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
49
50
51
52
53
54
55
###############################
# Řešení IJC-DU2
# Autor: Tomáš Matuš, FIT VUT Brno
# Login: xmatus37
# Datum: 19.4.2021
# Přeloženo: gcc 10.2.0
###############################
CC=gcc
CFLAGS=-g -std=c99 -pedantic -fPIC -Wall -Wextra
exec=tail wordcount wordcount-dynamic
htab_dep=htab_bucket_count.o htab_clear.o htab_erase.o htab_find.o htab_for_each.o \
htab_free.o htab_hash_function.o htab_init.o htab_lookup_add.o htab_move.o htab_size.o
all: $(exec)
#### TAIL
tail: tail.o
$(CC) -g -std=c99 -pedantic -Wall -Wextra $^ -o $@
#### WORDCOUNT
wordcount: wordcount.o io.o libhtab.a
$(CC) $(CFLAGS) -o $@ -static wordcount.o io.o -L. -lhtab
wordcount-dynamic: wordcount.o io.o libhtab.so
$(CC) $(CFLAGS) -o $@ wordcount.o io.o -L. -lhtab
# Static library
libhtab.a: $(htab_dep)
ar rcs $@ $^
# Dynamic library
libhtab.so: $(htab_dep)
$(CC) $(CFLAGS) -shared -o $@ $^
#### Object files
tail.o: tail.c
$(CC) -g -std=c99 -pedantic -Wall -Wextra -c $^
wordcount.o: wordcount.c
$(CC) -g -std=c99 -pedantic -Wall -Wextra -c $<
io.o: io.c io.h
$(CC) -g -std=c99 -pedantic -Wall -Wextra -c $<
# libhtab objects
%.o: %.c
$(CC) $(CFLAGS) -c $^
#### MISC
clean:
rm -f *.o $(exec) libhtab.a libhtab.so
zip:
zip xmatus37.zip *.c *.h Makefile