You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.2 KiB
Makefile

CC=gcc
CFLAGS=-std=c99 -Wall -Wextra
#-Werror -Wshadow -Wdouble-promotion \
-Wformat=2 -Wformat-truncation -fno-common -fstack-usage -Wconversion -Os \
-Werror=unused-function
BIN=./bin
SRC=./src
INC=./inc
TEST=./test
EXAMPLE_DIR=./example
TESTER_OBJS=$(BIN)/PCircularBuffer.o $(BIN)/test.o
EXAMPLE_OBJS=$(BIN)/PCircularBuffer.o $(BIN)/simple_circular_buffer_example.o
TESTER=$(BIN)/tester
EXAMPLE=$(BIN)/simple_circular_buffer_example
$(TESTER): $(TESTER_OBJS)
$(CC) $(CFLAGS) -o $@ $(TESTER_OBJS)
$(EXAMPLE): $(EXAMPLE_OBJS)
$(CC) $(CFLAGS) -o $@ $(EXAMPLE_OBJS)
$(BIN)/PCircularBuffer.o: $(SRC)/PCircularBuffer.c $(INC)/PCircularBuffer.h
$(CC) -c $(CFLAGS) -I$(INC) $(SRC)/PCircularBuffer.c -o $(BIN)/PCircularBuffer.o
$(BIN)/test.o: $(TEST)/test.c
$(CC) -c $(CFLAGS) -I$(INC) $(TEST)/test.c -o $(BIN)/test.o
$(BIN)/simple_circular_buffer_example.o: $(EXAMPLE_DIR)/simple_circular_buffer_example.c
$(CC) -c $(CFLAGS) -I$(INC) $(EXAMPLE_DIR)/simple_circular_buffer_example.c -o $(BIN)/simple_circular_buffer_example.o
all: $(TESTER) $(EXAMPLE)
clean:
rm -rf $(BIN)/*
test: $(TESTER)
$(TESTER)
example: $(EXAMPLE)
$(EXAMPLE)