aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPreston Pan <ret2pop@gmail.com>2024-12-27 20:05:06 -0800
committerPreston Pan <ret2pop@gmail.com>2024-12-27 20:05:06 -0800
commit63f11aaec8d21844a07fd27003a992c102a3a297 (patch)
tree6240a2c8561642d0c1d0b95148d6c868c7855a4a
parentfd14f6fbf8206589d2a0ad8f0793845cb8faf1d7 (diff)
make directory structure for client
-rw-r--r--Makefile25
-rw-r--r--client/main.c6
-rw-r--r--flake.nix1
-rw-r--r--include/array.h1
-rw-r--r--include/better_string.h1
-rw-r--r--server/array.c (renamed from src/array.c)0
-rw-r--r--server/better_string.c (renamed from src/better_string.c)0
-rw-r--r--server/hash_table.c (renamed from src/hash_table.c)0
-rw-r--r--server/helpers.c (renamed from src/helpers.c)0
-rw-r--r--server/main.c (renamed from src/main.c)0
-rw-r--r--server/opcodes.c (renamed from src/opcodes.c)0
-rw-r--r--server/tsv.c (renamed from src/tsv.c)0
12 files changed, 28 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 0460512..4b60314 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,17 @@
-SRC_DIR := src
-OBJ_DIR := obj
+SERVER_DIR := server
+CLIENT_DIR := client
+OBJ_DIR := server_obj
+CLIENT_OBJ_DIR := client_obj
BIN_DIR := bin
EXE := $(BIN_DIR)/umami
-SRC := $(wildcard $(SRC_DIR)/*.c)
-OBJ := $(SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
+CLIENT_EXE = $(BIN_DIR)/client
+
+SRC := $(wildcard $(SERVER_DIR)/*.c)
+OBJ := $(SRC:$(SERVER_DIR)/%.c=$(OBJ_DIR)/%.o)
+
+CLIENT_SRC := $(wildcard $(CLIENT_DIR/*.c))
+CLIENT_OBJ := $(CLIENT_SRC:$(CLIENT_DIR)/%.c=$(OBJ_DIR)/%.o)
CFLAGS := -Wall -Iinclude -lcrypto -lssl
LDFLAGS := -Llib
@@ -13,12 +20,18 @@ LDLIBS := -lm
CFLAGS += $(NIX_CFLAGS_COMPILE)
.PHONY: all clean
-all: $(EXE)
+all: $(EXE) $(CLIENT_EXE)
$(EXE): $(OBJ) | $(BIN_DIR)
$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
-$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c | $(OBJ_DIR)
+$(CLIENT_EXE): $(CLIENT_OBJ) | $(BIN_DIR)
+ $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
+
+$(OBJ_DIR)/%.o: $(SERVER_DIR)/%.c | $(OBJ_DIR)
+ $(CC) $(CFLAGS) -c $< -o $@
+
+$(CLIENT_OBJ_DIR)/%.o: $(CLIENT_DIR)/%.c | $(CLIENT_OBJ_DIR)
$(CC) $(CFLAGS) -c $< -o $@
$(BIN_DIR) $(OBJ_DIR):
diff --git a/client/main.c b/client/main.c
new file mode 100644
index 0000000..3587a00
--- /dev/null
+++ b/client/main.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main(int argc, char **argv) {
+ printf("HELLO WORLD\n");
+ return 0;
+}
diff --git a/flake.nix b/flake.nix
index 5072164..356cd73 100644
--- a/flake.nix
+++ b/flake.nix
@@ -25,6 +25,7 @@
installPhase = ''
mkdir -p $out/bin
cp ./bin/umami $out/bin/
+ cp ./bin/client $out/bin/
'';
};
};
diff --git a/include/array.h b/include/array.h
index 0b53f95..948dad2 100644
--- a/include/array.h
+++ b/include/array.h
@@ -19,4 +19,5 @@ void *array_pop(array_t *a);
void *array_del(array_t *a, unsigned int ind);
void array_free(void *a, void (*freefunc)(void *));
+
#endif
diff --git a/include/better_string.h b/include/better_string.h
index 09fd928..a5f9954 100644
--- a/include/better_string.h
+++ b/include/better_string.h
@@ -1,5 +1,6 @@
#ifndef STRING_H
#define STRING_H
+
#include <stdlib.h>
#define DEFAULT_STR_SIZE 10
typedef struct {
diff --git a/src/array.c b/server/array.c
index 84ed938..84ed938 100644
--- a/src/array.c
+++ b/server/array.c
diff --git a/src/better_string.c b/server/better_string.c
index 4413f77..4413f77 100644
--- a/src/better_string.c
+++ b/server/better_string.c
diff --git a/src/hash_table.c b/server/hash_table.c
index cced194..cced194 100644
--- a/src/hash_table.c
+++ b/server/hash_table.c
diff --git a/src/helpers.c b/server/helpers.c
index 8485dc6..8485dc6 100644
--- a/src/helpers.c
+++ b/server/helpers.c
diff --git a/src/main.c b/server/main.c
index 7a17966..7a17966 100644
--- a/src/main.c
+++ b/server/main.c
diff --git a/src/opcodes.c b/server/opcodes.c
index 8fc51f2..8fc51f2 100644
--- a/src/opcodes.c
+++ b/server/opcodes.c
diff --git a/src/tsv.c b/server/tsv.c
index 9b1c2be..9b1c2be 100644
--- a/src/tsv.c
+++ b/server/tsv.c