mirror of
https://github.com/guezoloic/t3dsr.git
synced 2026-01-25 09:34:24 +00:00
chore: Initialize basic targets in Makefile
This commit is contained in:
34
Makefile
Normal file
34
Makefile
Normal file
@@ -0,0 +1,34 @@
|
||||
EXE = t3dsr
|
||||
|
||||
INC = include
|
||||
SRC = src
|
||||
TST = test
|
||||
BLD = build
|
||||
|
||||
DEBUG_DIR = $(BLD)/debug
|
||||
|
||||
CC = clang
|
||||
CFLAGS = -Wall -Wextra -I$(INC) -g
|
||||
|
||||
SRCS = $(shell find $(SRC) -name "*.c")
|
||||
OBJS = $(SRCS:$(SRC)/%.c=$(DEBUG_DIR)/%.o)
|
||||
|
||||
$(EXE): $(OBJS) | $(DEBUG_DIR)
|
||||
@$(CC) $^ -o $(BLD)/$@
|
||||
|
||||
$(DEBUG_DIR):
|
||||
@mkdir -p $(DEBUG_DIR)
|
||||
|
||||
$(DEBUG_DIR)/%.o: $(SRC)/%.c | $(DEBUG_DIR)
|
||||
@mkdir -p $(dir $@)
|
||||
@$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
@rm -rf $(BLD) $(EXE)
|
||||
|
||||
run: $(EXE)
|
||||
@./$(BLD)/$(EXE)
|
||||
|
||||
all: $(EXE)
|
||||
|
||||
.PHONY: all clean run
|
||||
Reference in New Issue
Block a user