Initial Commit, project structure and build system.
This commit is contained in:
21
make/include/defaults.mk
Normal file
21
make/include/defaults.mk
Normal file
@@ -0,0 +1,21 @@
|
||||
CC ?= i686-w64-mingw32-gcc
|
||||
CFLAGS = -Wall -Wextra -pedantic -Werror -std=c23
|
||||
|
||||
SRC_DIR = src
|
||||
SRC_DIR_COMMON = $(SRC_DIR)/common
|
||||
SRC_DIR_RUNTIME = $(SRC_DIR)/runtime
|
||||
SRC_DIR_LOADER = $(SRC_DIR)/loader
|
||||
|
||||
SOURCES_COMMON := $(shell find $(SRC_DIR_COMMON) -name '*.c')
|
||||
SOURCES_RUNTIME := $(shell find $(SRC_DIR_RUNTIME) -name '*.c')
|
||||
SOURCES_LOADER := $(shell find $(SRC_DIR_LOADER) -name '*.c')
|
||||
|
||||
BUILD_DIR ?= build
|
||||
|
||||
OBJECTS_COMMON = $(SOURCES_COMMON:%.c=$(BUILD_DIR)/%.o)
|
||||
OBJECTS_RUNTIME = $(SOURCES_RUNTIME:%.c=$(BUILD_DIR)/%.o)
|
||||
OBJECTS_LOADER = $(SOURCES_LOADER:%.c=$(BUILD_DIR)/%.o)
|
||||
|
||||
DEPS_COMMON = $(SOURCES_COMMON:%.c=$(BUILD_DIR)/%.d)
|
||||
DEPS_RUNTIME = $(SOURCES_RUNTIME:%.c=$(BUILD_DIR)/%.d)
|
||||
DEPS_LOADER = $(SOURCES_LOADER:%.c=$(BUILD_DIR)/%.d)
|
||||
9
make/include/shared.mk
Normal file
9
make/include/shared.mk
Normal file
@@ -0,0 +1,9 @@
|
||||
$(TARGET): $(OBJECTS)
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
|
||||
|
||||
-include $(DEPS)
|
||||
Reference in New Issue
Block a user