aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--Makefile45
-rw-r--r--config.lua.example9
-rw-r--r--meson.build18
4 files changed, 56 insertions, 19 deletions
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'])