big refactor of pretty much everything

I still need to make the Makefile better as it's pretty shit right now
but it's alright for now I think
This commit is contained in:
jacekpoz 2024-02-11 23:23:50 +01:00
parent 5601945db1
commit d24c1d3767
No known key found for this signature in database
GPG key ID: 94E812A8B12AAE3C
16 changed files with 32 additions and 20 deletions

View file

@ -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

View file

@ -16,7 +16,7 @@ typedef struct {
Module *modules;
} Config;
char *default_config_path();
char *default_config_path(void);
void parsing_error(size_t line);

View file

@ -1,7 +1,8 @@
#ifndef _MODFETCH_MOD_H
#define _MODFETCH_MOD_H
#include "semver.h"
#include <semver.h>
#include <stdint.h>
static const semver API_VERSION = {

View file

@ -4,7 +4,8 @@
* 09 Feb 2024
*/
#include "../mod.h"
#include <mod.h>
#include <stdio.h>
#include <stdlib.h>

View file

@ -4,7 +4,8 @@
* 09 Feb 2024
*/
#include "../mod.h"
#include <mod.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View file

@ -8,7 +8,8 @@
* 09 Feb 2024
*/
#include "../mod.h"
#include <mod.h>
#include <string.h>
#include <stdlib.h>

View file

@ -1,5 +1,7 @@
#include "config.h"
#include "util.h"
#include <config.h>
#include <util.h>
#include <errno.h>
#include <stdbool.h>
#include <stddef.h>
@ -7,7 +9,7 @@
#include <stdlib.h>
#include <string.h>
char *default_config_path() {
char *default_config_path(void) {
char *config_path = NULL;
char *config_dir = getenv("XDG_CONFIG_HOME");

BIN
src/config.o Normal file

Binary file not shown.

View file

@ -1,7 +1,7 @@
#include "config.h"
#include "mod.h"
#include "semver.h"
#include "util.h"
#include <config.h>
#include <mod.h>
#include <semver.h>
#include <util.h>
#include <ctype.h>
#include <dlfcn.h>

BIN
src/modfetch.o Normal file

Binary file not shown.

View file

@ -1,4 +1,5 @@
#include "semver.h"
#include <semver.h>
#include <stdio.h>
#include <stdlib.h>

BIN
src/semver.o Normal file

Binary file not shown.

View file

@ -1,4 +1,5 @@
#include "util.h"
#include <util.h>
#include <ctype.h>
#include <stdbool.h>
#include <stdlib.h>

BIN
src/util.o Normal file

Binary file not shown.