From 9480e6d50d0ea549f894d9375c9be47f17db7f6b Mon Sep 17 00:00:00 2001 From: forever2k38 Date: Mon, 31 Aug 2026 14:00:12 +0200 Subject: use makefile --- .gitignore | 3 ++- Makefile | 45 +++++++++++++++++++++++++++++++++++++++++++++ config.lua.example | 9 +++++++++ meson.build | 18 ------------------ 4 files changed, 56 insertions(+), 19 deletions(-) create mode 100644 Makefile create mode 100644 config.lua.example delete mode 100644 meson.build diff --git a/.gitignore b/.gitignore index 567609b..7080b0e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -build/ +pow +out diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4d60105 --- /dev/null +++ b/Makefile @@ -0,0 +1,45 @@ +CC=cc + +BIN_EXT = +MKDIR = mkdir -p $(OUT_DIR) $(dir $@) +RM = rm -rf + +CFLAGS=-Wall -Wpedantic + +LIBFLAGS=$(shell pkg-config --cflags --libs lua55) +DEBUG_CFLAGS=-g + +SRC_DIR=src +OUT_DIR=out +TARGET=pow +CFLAGS+=$(LIBFLAGS) + +ifeq ($(wildcard $(SRC_DIR)),) +$(error Source directory '$(SRC_DIR)' not found. Please specify the source directory using 'make SRC_DIR=path/to/source' or edit the makefile) +endif + +SRC_FILES := $(wildcard $(SRC_DIR)/**/*.c) $(wildcard $(SRC_DIR)/*.c) + +OBJ_FILES := $(patsubst $(SRC_DIR)/%.c,$(OUT_DIR)/%.o,$(SRC_FILES)) + +DEP_FILES := $(OBJ_FILES:.o=.d) + +$(OUT_DIR)/%.o: $(SRC_DIR)/%.c + $(MKDIR) + $(CC) -c -o $@ $< $(CFLAGS) + +-include $(DEP_FILES) + +all: $(TARGET) + +debug: CFLAGS += $(DEBUG_CFLAGS) +debug: $(TARGET) + +$(TARGET): $(OBJ_FILES) + $(CC) -o $@$(BIN_EXT) $^ $(CFLAGS) + +.PHONY: clean + +clean: + $(RM) $(OUT_DIR) $(TARGET)$(BIN_EXT) + diff --git a/config.lua.example b/config.lua.example new file mode 100644 index 0000000..441f6d8 --- /dev/null +++ b/config.lua.example @@ -0,0 +1,9 @@ +local config = {} + +config.repos = { + { + path = "../testing", + }, +} + +return config diff --git a/meson.build b/meson.build deleted file mode 100644 index fba438e..0000000 --- a/meson.build +++ /dev/null @@ -1,18 +0,0 @@ -project('pow', 'c', default_options: ['c_std=c99']) - -deps = [ - dependency('lua55') -] - -sources = [ - 'src/main.c', - - 'src/args.c', - 'src/config.c', - 'src/repo.c', - 'src/utils.c', - 'src/package.c', - 'src/pow_lua.c' -] - -executable('pow', sources, dependencies: deps, c_args: ['-D_GNU_SOURCE', '-D_XOPEN_SOURCE=700']) -- cgit v1.3