Skip to content

Commit

Permalink
knihovny
Browse files Browse the repository at this point in the history
  • Loading branch information
saytaM12 committed Apr 5, 2023
1 parent 68f1172 commit fd7fcec
Show file tree
Hide file tree
Showing 23 changed files with 289 additions and 858 deletions.
23 changes: 13 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ CC := clang
CFLAGS := -g -Wall -std=c11 -pedantic -DSTATISTICS -Wextra -O2
CREATEDIR := $(shell mkdir -p obj)

DEPENDENCIES:=$(shell $(CC) -MM *.c | sed -r 's/.*:.*/obj\/\0/' > dep.d)

-include dep.d

.PHONY: all
all: tail wordcount wordcount-dynamic
# a knihovny "libhtab.a", "libhtab.so

cpp: src/to_je_jedno.cpp
cpp: to_je_jedno.cpp
clang++ -O3 $^ -o $@

tail: obj/tail.o
Expand All @@ -15,19 +19,18 @@ tail: obj/tail.o
wordcount: obj/io.o obj/htab.o obj/wordcount.o libhtab.a
$(CC) $(CFLAGS) -lm $^ -o $@

wordcount-dynamic: obj/wordcount.o obj/htab.o libhtab.so
wordcount-dynamic: obj/wordcount-dynamic.o obj/htab.o libhtab.so
$(CC) $(CFLAGS) -lm $^ -o $@


obj/wordcount.o: src/wordcount.c src/io.h src/htab.h
obj/io.o: src/io.c
obj/htab.o: src/htab.c src/htab.h
obj/tail.o: src/tail.c

obj/%.o: src/%.c
%.o: %.c
$(CC) $(CFLAGS) $< -c -o $@

lib/libhtab.a: obj/htab_bucket_count.o obj/htab_clear.o obj/htab_erase.o obj/htab_find.o obj/htab_for_each.o obj/htab_free.o obj/htab_hash_function.o obj/htab_init.o obj/htab_lookup_add.o obj/htab_size.o obj/htab_statistics.o
ar r $@ $^

lib/libhtab.so: obj/htab_bucket_count.o obj/htab_clear.o obj/htab_erase.o obj/htab_find.o obj/htab_for_each.o obj/htab_free.o obj/htab_hash_function.o obj/htab_init.o obj/htab_lookup_add.o obj/htab_size.o obj/htab_statistics.o
$(CC) -shared $^ -o $@

.PHONY: clean
clean:
-rm -r ./obj/ tail wordcount cpp
-rm -r ./obj/ tail wordcount cpp *.o
318 changes: 0 additions & 318 deletions cppoutput

This file was deleted.

14 changes: 14 additions & 0 deletions dep.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
obj/htab_bucket_count.o: htab_bucket_count.c private_htab.h htab.h
obj/htab_clear.o: htab_clear.c private_htab.h htab.h
obj/htab_erase.o: htab_erase.c private_htab.h htab.h
obj/htab_find.o: htab_find.c private_htab.h htab.h
obj/htab_for_each.o: htab_for_each.c private_htab.h htab.h
obj/htab_free.o: htab_free.c private_htab.h htab.h
obj/htab_hash_function.o: htab_hash_function.c htab.h
obj/htab_init.o: htab_init.c private_htab.h htab.h
obj/htab_lookup_add.o: htab_lookup_add.c private_htab.h htab.h
obj/htab_size.o: htab_size.c private_htab.h htab.h
obj/htab_statistics.o: htab_statistics.c private_htab.h htab.h
obj/io.o: io.c
obj/tail.o: tail.c
obj/wordcount.o: wordcount.c io.h htab.h
File renamed without changes.
9 changes: 9 additions & 0 deletions htab_bucket_count.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// htab_bucket_count.c
// Řešení IJC-DU2, příklad 1), 18.4.2023
// Autor: Matyáš Oujezdský, FIT
// Přeloženo: clang version 10.0.0-4ubuntu1
#include "private_htab.h"

size_t htab_bucket_count(const htab_t *t) {
return t->arr_size;
}
Loading

0 comments on commit fd7fcec

Please sign in to comment.