diff options
| author | Collin Williams <96917990+bluedragon1221@users.noreply.github.com> | 2026-05-11 15:07:55 -0500 |
|---|---|---|
| committer | Collin Williams <96917990+bluedragon1221@users.noreply.github.com> | 2026-05-11 15:07:55 -0500 |
| commit | cebb280fe546190e55e071b6adbf37cd47950f34 (patch) | |
| tree | 6e7a7605f8832b1c1bd7e467884a8792a5e1fab4 /Makefile | |
initial commit
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e6f5cda --- /dev/null +++ b/Makefile @@ -0,0 +1,46 @@ +.PHONY: build test run clean rebuild + +CC ?= gcc +PKG_CONFIG ?= pkg-config + +BUILD_DIR := build +OBJ_DIR := $(BUILD_DIR)/obj +BIN := $(BUILD_DIR)/lemacs +RUN_FILE ?= + +SRC := \ + src/main.c \ + src/core/buffer.c \ + src/core/editor.c \ + src/core/lua_bridge.c + +OBJ := $(SRC:src/%.c=$(OBJ_DIR)/%.o) +DEP := $(OBJ:.o=.d) + +CPPFLAGS += -Isrc -DLEMACS_RUNTIME_INIT=\"$(CURDIR)/runtime/init.lua\" +CFLAGS += -std=c99 -Wall -Wextra -Wpedantic -O2 -MMD -MP +LDLIBS += $(shell $(PKG_CONFIG) --libs raylib lua5.4 fontconfig) -lm +LDFLAGS += + +build: $(BIN) + +$(BIN): $(OBJ) + mkdir -p "$(BUILD_DIR)" + $(CC) $(OBJ) $(LDFLAGS) $(LDLIBS) -o "$@" + +$(OBJ_DIR)/%.o: src/%.c + mkdir -p "$(dir $@)" + $(CC) $(CPPFLAGS) $(CFLAGS) $(shell $(PKG_CONFIG) --cflags raylib lua5.4 fontconfig) -c "$<" -o "$@" + +test: build + printf '%s\n' 'No test suite is configured yet.' + +run: build + "./$(BIN)" $(RUN_FILE) + +clean: + rm -rf "$(BUILD_DIR)" + +rebuild: clean build + +-include $(DEP) |
