Big initial commit: States, simulation, presentation, menus, some art.
This commit is contained in:
60
Makefile
Normal file
60
Makefile
Normal file
@@ -0,0 +1,60 @@
|
||||
CC := gcc
|
||||
SRC_DIR := src
|
||||
|
||||
UNAME_S := $(shell uname -s)
|
||||
|
||||
ifeq ($(UNAME_S), Linux)
|
||||
PLATFORM := linux
|
||||
else ifeq ($(OS), Windows_NT)
|
||||
PLATFORM := windows
|
||||
else
|
||||
PLATFORM := unknown
|
||||
endif
|
||||
|
||||
BUILD_DIR := build/$(PLATFORM)
|
||||
CFLAGS := -g -Isrc -Wextra -MMD -MP -Wall -pedantic
|
||||
LDFLAGS := -flto -Wl,--gc-sections
|
||||
|
||||
LIB_DIR := $(abspath libs/$(PLATFORM))
|
||||
CFLAGS += -I$(LIB_DIR)
|
||||
LDFLAGS += -L$(LIB_DIR)
|
||||
|
||||
ifeq ($(PLATFORM), linux)
|
||||
LIBS += -lraylib -lm -lraygui
|
||||
endif
|
||||
|
||||
SRC := $(shell find -L $(SRC_DIR) -type f -name '*.c')
|
||||
|
||||
OBJ := $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(SRC))
|
||||
DEP := $(OBJ:.o=.d)
|
||||
|
||||
ifeq ($(PLATFORM), windows)
|
||||
BIN := $(BUILD_DIR)/main.exe
|
||||
endif
|
||||
ifeq ($(PLATFORM), linux)
|
||||
BIN := $(BUILD_DIR)/main
|
||||
endif
|
||||
|
||||
|
||||
all: $(BIN)
|
||||
|
||||
run: $(BIN)
|
||||
@cd $(BUILD_DIR) && ./$(notdir $(BIN))
|
||||
|
||||
$(BIN): $(OBJ)
|
||||
@mkdir -p $(dir $@)
|
||||
@cp -r $(SRC_DIR)/assets $(BUILD_DIR)
|
||||
@cp -r libs $(BUILD_DIR)
|
||||
@$(CC) $(LDFLAGS) $(OBJ) -o $@ $(LIBS)
|
||||
|
||||
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
|
||||
@echo "Compiling $<..."
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
@rm -rf $(BUILD_DIR)
|
||||
|
||||
-include $(DEP)
|
||||
|
||||
.PHONY: all clean
|
||||
Reference in New Issue
Block a user