diff --git a/Makefile b/Makefile index 92aa9b2..c1b6b0b 100644 --- a/Makefile +++ b/Makefile @@ -6,16 +6,20 @@ CFLAGS += -Wcast-qual -Wswitch-default -Wswitch-enum CFLAGS += -Wconversion -Wunreachable-code # for asprintf() and getline() CFLAGS += -D_GNU_SOURCE +CFLAGS += -Iinclude LDFLAGS = NAME = modfetch -PROG = modfetch.c -LIB = config.c semver.c util.c -OBJ = $(PROG:.c=.o) $(LIB:.c=.o) +SRC = src +_PROG = modfetch.c +PROG = $(addprefix $(SRC)/, $(_PROG)) +_LIB = config.c semver.c util.c +LIB = $(addprefix $(SRC)/, $(_LIB)) +OBJ = $(_PROG:.c=.o) $(_LIB:.c=.o) BIN = target -TEMPMOD = $(wildcard modules/*.c) -MOD = $(TEMPMOD:modules/%=%) +_MOD = $(wildcard modules/*.c) +MOD = $(_MOD:modules/%=%) .PHONY: all clean @@ -32,7 +36,7 @@ $(NAME): $(OBJ) %.so: modules/%.c $(LIB) $(CC) $^ -shared -fPIC $(CFLAGS) $(LDFLAGS) -o $(BIN)/$@ -%.o: %.c +%.o: src/%.c $(CC) -c $< $(CFLAGS) -o $(BIN)/$@ clean: clean_modules diff --git a/config.h b/include/config.h similarity index 92% rename from config.h rename to include/config.h index a6ba16c..5dcc01e 100644 --- a/config.h +++ b/include/config.h @@ -16,7 +16,7 @@ typedef struct { Module *modules; } Config; -char *default_config_path(); +char *default_config_path(void); void parsing_error(size_t line); diff --git a/mod.h b/include/mod.h similarity index 94% rename from mod.h rename to include/mod.h index c05d356..f46a749 100644 --- a/mod.h +++ b/include/mod.h @@ -1,7 +1,8 @@ #ifndef _MODFETCH_MOD_H #define _MODFETCH_MOD_H -#include "semver.h" +#include + #include static const semver API_VERSION = { diff --git a/semver.h b/include/semver.h similarity index 100% rename from semver.h rename to include/semver.h diff --git a/util.h b/include/util.h similarity index 100% rename from util.h rename to include/util.h diff --git a/modules/desktop.c b/modules/desktop.c index 6e63924..88be1b4 100644 --- a/modules/desktop.c +++ b/modules/desktop.c @@ -4,7 +4,8 @@ * 09 Feb 2024 */ -#include "../mod.h" +#include + #include #include diff --git a/modules/os.c b/modules/os.c index e27cf97..d32c610 100644 --- a/modules/os.c +++ b/modules/os.c @@ -4,7 +4,8 @@ * 09 Feb 2024 */ -#include "../mod.h" +#include + #include #include #include diff --git a/modules/sep.c b/modules/sep.c index 9dfafd6..f8e5d56 100644 --- a/modules/sep.c +++ b/modules/sep.c @@ -8,7 +8,8 @@ * 09 Feb 2024 */ -#include "../mod.h" +#include + #include #include diff --git a/config.c b/src/config.c similarity index 97% rename from config.c rename to src/config.c index 13ebecd..ee7644d 100644 --- a/config.c +++ b/src/config.c @@ -1,5 +1,7 @@ -#include "config.h" -#include "util.h" +#include + +#include + #include #include #include @@ -7,7 +9,7 @@ #include #include -char *default_config_path() { +char *default_config_path(void) { char *config_path = NULL; char *config_dir = getenv("XDG_CONFIG_HOME"); diff --git a/src/config.o b/src/config.o new file mode 100644 index 0000000..67de75d Binary files /dev/null and b/src/config.o differ diff --git a/modfetch.c b/src/modfetch.c similarity index 97% rename from modfetch.c rename to src/modfetch.c index 1051e0f..3da1693 100644 --- a/modfetch.c +++ b/src/modfetch.c @@ -1,7 +1,7 @@ -#include "config.h" -#include "mod.h" -#include "semver.h" -#include "util.h" +#include +#include +#include +#include #include #include diff --git a/src/modfetch.o b/src/modfetch.o new file mode 100644 index 0000000..4213e3d Binary files /dev/null and b/src/modfetch.o differ diff --git a/semver.c b/src/semver.c similarity index 96% rename from semver.c rename to src/semver.c index 790a334..ffc4836 100644 --- a/semver.c +++ b/src/semver.c @@ -1,4 +1,5 @@ -#include "semver.h" +#include + #include #include diff --git a/src/semver.o b/src/semver.o new file mode 100644 index 0000000..cb48ac4 Binary files /dev/null and b/src/semver.o differ diff --git a/util.c b/src/util.c similarity index 98% rename from util.c rename to src/util.c index 2ff20b6..dc4d86d 100644 --- a/util.c +++ b/src/util.c @@ -1,4 +1,5 @@ -#include "util.h" +#include + #include #include #include diff --git a/src/util.o b/src/util.o new file mode 100644 index 0000000..5412c5b Binary files /dev/null and b/src/util.o differ