-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (34 loc) · 1.11 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
# Makefile
# Řešení IJC-DU2, příklad 1) a 2), 8.4. 2023
# Autor: Jakub Antonín Štigler, FIT
# Přeloženo: cc - clang 15.0.7
# Funguje s gcc 12.2.1
# Usage:
# make # builds tail, wordcount and wordcount-dynamic
# make wordcount++ # builds wordcount++
# make clean # deletes all files generated by makefile
# make CFLAGS=-DSTATISTICS # adds statistics to the wordcount program
override CFLAGS:= -g -Wall -pedantic -std=c11 -Wextra -O2 -fPIC $(CFLAGS)
override LDFLAGS:= -g -O2 $(LDFLAGS)
HTAB:=htab_basic.o htab_clean.o htab_for_each.o htab_hash_function.o \
htab_lookup.o htab_statistics.o htab_primes.o
SUBNAME:=xstigl00
.PHONY: all clean submit
all: tail wordcount wordcount-dynamic
T:=$(shell $(CC) -MM *.c > dep.d)
-include dep.d
tail:
libhtab.a: $(HTAB)
ar r $@ $^
libhtab.so: $(HTAB)
$(CC) -shared -o $@ $^
wordcount: io.o wordcount.o libhtab.a
$(CC) $(LDFLAGS) -o $@ $^
wordcount-dynamic: io.o wordcount.o libhtab.so
$(CC) $(LDFLAGS) -o $@ $^
wordcount++:
clean:
-rm *.o tail *.a wordcount *.so wordcount-dynamic wordcount++ dep.d \
wordcount++.o
submit:
zip $(SUBNAME).zip *.c *.cpp *.h Makefile