# Makefile # Řešení IJC-DU1, 22.3.2024 # Autor: Roman Nečas, FIT # Compiler and Flags CC=gcc CFLAGS += -g -std=c11 -pedantic -Wall -Wextra -fsanitize=address -O2 LDFLAGS += -fsanitize=address # Executables EXECUTABLES = primes primes-i no-comment # Default Target .PHONY: all all: $(EXECUTABLES) # Rules for Targets primes: primes.o error.o eratosthenes.o $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ primes-i: primes-i.o error.o eratosthenes-i.o bitset.o $(CC) $(CFLAGS) $(LDFLAGS) -DUSE_INLINE $^ -o $@ no-comment: no-comment.o error.o $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ # Rules for Object Files primes.o: primes.c primes.h bitset.h primes-i.o: primes.c $(CC) $(CFLAGS) -DUSE_INLINE -c $^ -o $@ eratosthenes.o: eratosthenes.c primes.h bitset.h eratosthenes-i.o: eratosthenes.c primes.h $(CC) $(CFLAGS) -DUSE_INLINE -c $< -o $@ bitset.o: bitset.c bitset.h $(CC) $(CFLAGS) -DUSE_INLINE -c $< -o $@ error.o: error.c error.h no-comment.o: no-comment.c error.h # Clean .PHONY: clean clean: rm $(EXECUTABLES) *.o # Run .PHONY: run run: primes primes-i ulimit -s 81920 && ./primes ulimit -s 81920 && ./primes-i