46 lines
999 B
Makefile
46 lines
999 B
Makefile
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
|
|
LDFLAGS =
|
|
|
|
NAME = z1
|
|
|
|
SRC = src
|
|
BIN = target
|
|
|
|
_PROG = main.c
|
|
PROG = $(addprefix $(SRC)/, $(_PROG))
|
|
|
|
_LIB_ITER = mod_iter.c
|
|
LIB_ITER = $(addprefix $(SRC)/, $(_LIB_ITER))
|
|
|
|
_LIB_REC = mod_rec.c
|
|
LIB_REC = $(addprefix $(SRC)/, $(_LIB_REC))
|
|
|
|
OBJ = $(_PROG:.c=.o)
|
|
OBJ_ITER = $(_LIB_ITER:.c=.o)
|
|
OBJ_REC = $(_LIB_REC:.c=.o)
|
|
|
|
.PHONY: all clean
|
|
|
|
all: dirs iter rec
|
|
|
|
dirs:
|
|
mkdir -p $(BIN)
|
|
|
|
iter: $(OBJ) $(OBJ_ITER)
|
|
$(CC) $(addprefix $(BIN)/, $^) $(LDFLAGS) -o $(BIN)/$(NAME)_$@
|
|
|
|
rec: $(OBJ) $(OBJ_REC)
|
|
$(CC) $(addprefix $(BIN)/, $^) $(LDFLAGS) -o $(BIN)/$(NAME)_$@
|
|
|
|
%.o: src/%.c
|
|
$(CC) -c $< $(CFLAGS) -o $(BIN)/$@
|
|
|
|
clean:
|
|
rm -rf $(addprefix $(BIN)/, $(OBJ))
|
|
rm -rf $(BIN)/$(NAME)
|