27 lines
405 B
Makefile
27 lines
405 B
Makefile
|
BIN = bin
|
||
|
OUT = $(BIN)/out
|
||
|
|
||
|
SRC = $(shell find src -type f -name "*.c")
|
||
|
OBJ = $(patsubst %.c,$(BIN)/%.o, $(SRC))
|
||
|
|
||
|
CCFLAGS = -Isrc -std=c2x -Wall -Wextra -pedantic -O0 -g
|
||
|
LDFLAGS =
|
||
|
|
||
|
CC = gcc
|
||
|
LD = gcc
|
||
|
|
||
|
.PHONY: build
|
||
|
|
||
|
build: $(OUT)
|
||
|
|
||
|
$(OBJ): $(BIN)/%.o : %.c
|
||
|
@mkdir -p $(@D)
|
||
|
$(CC) -c $(CCFLAGS) -o $@ $<
|
||
|
|
||
|
$(OUT): $(OBJ) $(ASM_OBJ)
|
||
|
@mkdir -p $(@D)
|
||
|
$(LD) -o $(OUT) $(OBJ) $(LDFLAGS)
|
||
|
|
||
|
clean:
|
||
|
rm -fr $(BIN)
|