Examples and fixing stuff

This commit is contained in:
Leonardo Vencovsky committed 2023-01-25 13:35:16 +01:00
1 parent a8c1619be6
commit bd338f2fe3
10 files changed
+42 -47

No files matched your search

+15 -20
View File
@@ -2,36 +2,31 @@ CC=gcc
CFLAGS=-Wall -Wextra -Werror -O3
INCLUDE=-I ../src
dfs: dfs.c
$(CC) $< -o $@.exe $(CFLAGS) $(INCLUDE)
./$@.exe
example: example.c
$(CC) $< -o $@.exe $(CFLAGS) $(INCLUDE)
./$@.exe
hanoi: hanoi.c
$(CC) $< -o $@.exe $(CFLAGS) $(INCLUDE)
./$@.exe
heapsort: heapsort.c
$(CC) $< -o $@.exe $(CFLAGS) $(INCLUDE)
./$@.exe
sieve: sieve.c
ifndef FILE
main:
@echo Please define a FILE parameter to run. Examples:
@echo " dfs"
@echo " example"
@echo " hanoi"
@echo " heapsort"
@echo " ice_cream"
@echo " sieve"
else
$(FILE): $(FILE).c
$(CC) $< -o $@.exe $(CFLAGS) $(INCLUDE)
./$@.exe
endif
clean:
rm *.exe
rm *.txt
rm *.exe -f
rm *.txt -f
memcheck:
ifndef FILE
$(error FILE parameter must be set first to check for leaks)
else
$(CC) $(FILE) -o mem.exe $(CFLAGS) $(INCLUDE) -g
$(CC) $(FILE).c -o mem.exe $(CFLAGS) $(INCLUDE) -g
valgrind --leak-check=yes ./mem.exe
endif