SHELL := /bin/bash CC = gcc -std=gnu99 RM = rm -f CFLAGS_DEBUG=-O0 -ggdb3 -Wall -Werror -pedantic -D_FORTIFY_SOURCE=2 -fasynchronous-unwind-tables -grecord-gcc-switches -Werror=implicit-function-declaration -I. CFLAGS=-O2 -Wall -Werror -pedantic -I. TESTS_SRC = $(wildcard test/*.c) EXECS_SRC = $(wildcard zaqar/*.c) DEPS_SRC = $(wildcard lib/*.c) DEPS_OBJ = $(DEPS_SRC:.c=.o) TESTS_OBJ = $(DEPS_OBJ) \ $(TESTS_SRC:.c=.o) EXECS_OBJ = $(DEPS_OBJ) \ $(EXECS_SRC:.c=.o) ALL_OBJ = $(DEPS_OBJ) \ $(TESTS_SRC:.c=.o) \ $(EXECS_SRC:.c=.o) DEPS_TRACK = $(OBJ:.o=.d) TESTS = test/test_circ_buff EXECUTABLES = zaqar .PHONY: all all: $(TESTS) $(EXECUTABLES) execs: $(EXECUTABLES) tests: $(TESTS) $(TESTS): $(TESTS_OBJ) $(CC) -o $@ $^ $(CFLAGS) $(EXECUTABLES): $(EXECS_OBJ) $(CC) -o $@ $^ $(CFLAGS) -include $(DEPS_TRACK) %.d: %.c @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ .PHONY: clean clean: rm -f $(ALL_OBJ) $(TESTS) $(EXECUTABLES) .PHONY: cleandep cleandep: rm -f $(DEPS_TRACK)