aisd_lab/lab01/zad2/Makefile

36 lines
718 B
Makefile
Raw Normal View History

2024-03-10 20:11:25 +01:00
CC = gcc
CFLAGS = -std=c99 -O3 -Wall -Wextra -Wpedantic -Wstrict-aliasing
CFLAGS += -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wcast-align
CFLAGS += -Wstrict-prototypes -Wstrict-overflow=5 -Wwrite-strings
CFLAGS += -Wcast-qual -Wswitch-default -Wswitch-enum
CFLAGS += -Wconversion -Wunreachable-code
CFLAGS += -Iinclude -g
LDFLAGS =
NAME = zad2
SRC = src
BIN = target
_PROG = main.c linked_list.c
PROG = $(addprefix $(SRC)/, $(_PROG))
OBJ = $(_PROG:.c=.o)
.PHONY: all clean
all: dirs $(NAME)
dirs:
mkdir -p $(BIN)
$(NAME): $(OBJ)
$(CC) $(addprefix $(BIN)/, $^) $(LDFLAGS) -o $(BIN)/$@
%.o: src/%.c
$(CC) -c $< $(CFLAGS) -o $(BIN)/$@
clean:
rm -rf $(addprefix $(BIN)/, $(OBJ))
rm -rf $(BIN)/$(NAME)