Created makefile

This commit is contained in:
Tomas Rivera
2026-03-30 14:12:19 +02:00
parent 5f38052101
commit 0cbb5e58fd
4 changed files with 10 additions and 29 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
config file in json config file in json
requierements neovim, nvim-tree, vivify, vivify.vim requierements neovim vivify, vivify.vim, ncurses, cjson, pkg-config,
1. launches a TUI 1. launches a TUI
- asks if you want to open an already existing directory (by default in ~/Documents/Notes but can be changed in the config file) or create a new directory - asks if you want to open an already existing directory (by default in ~/Documents/Notes but can be changed in the config file) or create a new directory
+1 -19
View File
@@ -1,35 +1,17 @@
# Makefile for the Notes Vault project
# Compiler
CC = gcc CC = gcc
# Source files
SRC = startup.c SRC = startup.c
# Output binary
TARGET = nvimnotes TARGET = nvimnotes
# Compiler flags
CFLAGS = -Wall -O2 `pkg-config --cflags libcjson ncurses` CFLAGS = -Wall -O2 `pkg-config --cflags libcjson ncurses`
# Linker flags
LDFLAGS = `pkg-config --libs libcjson ncurses` LDFLAGS = `pkg-config --libs libcjson ncurses`
# Debug mode
DEBUG ?= 0 DEBUG ?= 0
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)
CFLAGS += -g CFLAGS += -g
endif endif
.PHONY: all clean run .PHONY: all clean run
all: $(TARGET) all: $(TARGET)
$(TARGET): $(SRC) $(TARGET): $(SRC)
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
run: $(TARGET) run: $(TARGET)
./$(TARGET) ./$(TARGET)
clean: clean:
rm -f $(TARGET) rm -f $(TARGET)
-1
View File
@@ -2,7 +2,6 @@
pkgs.mkShell { pkgs.mkShell {
buildInputs = [ buildInputs = [
pkgs.vivify
pkgs.cjson pkgs.cjson
pkgs.ncurses pkgs.ncurses
pkgs.pkg-config pkgs.pkg-config
+8 -8
View File
@@ -256,7 +256,7 @@ int main(int argc, char *argv[]) {
char *vaultSelected = ncursesSelect(vaultsArray, "vault", vaultsCount + extraOptions, debug); char *vaultSelected = ncursesSelect(vaultsArray, "vault", vaultsCount + extraOptions, debug);
if (debug) {printf("\e[0;32m[DEBUG]\e[0m Selected vault:%s\n", vaultSelected);} if (debug) {printf("\e[0;32m[DEBUG]\e[0m Selected vault:%s\n", vaultSelected);}
if (vaultSelected != "Create a new vault" && vaultSelected != "Settings" && vaultSelected != "Quit (Ctrl+C)") { if (strcmp(vaultSelected,"Create a new vault") != 0 && strcmp(vaultSelected,"Settings") != 0 && strcmp(vaultSelected,"Quit (Ctrl+C)") != 0) {
int shouldChangeVault = 0; int shouldChangeVault = 0;
while (!shouldExit && !shouldChangeVault) { while (!shouldExit && !shouldChangeVault) {
// this loop is the note selector // this loop is the note selector
@@ -280,25 +280,25 @@ int main(int argc, char *argv[]) {
char *noteSelected = ncursesSelect(filesArray, "note", filesCount + extraNotesOptions, debug); char *noteSelected = ncursesSelect(filesArray, "note", filesCount + extraNotesOptions, debug);
if (debug) {printf("\e[0;32m[DEBUG]\e[0m Selected note: %s\n", noteSelected);} if (debug) {printf("\e[0;32m[DEBUG]\e[0m Selected note: %s\n", noteSelected);}
if (noteSelected != "Create new note" && noteSelected != "Back to vault selection" && noteSelected != "Quit (Ctrl+C)") { if (strcmp(noteSelected, "Create new note") != 0 && strcmp(noteSelected,"Back to vault selection") != 0 && strcmp(noteSelected,"Quit (Ctrl+C)") != 0) {
char fullPath[PATH_MAX]; char fullPath[PATH_MAX];
sprintf(fullPath, "%s/%s/%s", notesDirectoryString, vaultSelected, noteSelected); sprintf(fullPath, "%s/%s/%s", notesDirectoryString, vaultSelected, noteSelected);
openNvim(fullPath, debug); openNvim(fullPath, debug);
} else if (noteSelected == "Create new note") { } else if (strcmp(noteSelected,"Create new note") == 0) {
} else if (noteSelected == "Back to vault selection") { } else if (strcmp(noteSelected,"Back to vault selection") == 0) {
shouldChangeVault = 1; shouldChangeVault = 1;
} else if (noteSelected == "Quit (Ctrl+C)") { } else if (strcmp(noteSelected,"Quit (Ctrl+C)") == 0) {
if (debug) {printf("\e[0;32m[DEBUG]\e[0m The program was exited,\n");} if (debug) {printf("\e[0;32m[DEBUG]\e[0m The program was exited,\n");}
shouldExit = 1; shouldExit = 1;
} }
} }
} else if (vaultSelected == "Create a new vault") { } else if (strcmp(vaultSelected,"Create a new vault") == 0) {
} else if (vaultSelected == "Settings") { } else if (strcmp(vaultSelected,"Settings") == 0) {
//(TODO LATER) add a way to change the config.json from the app or at least show all the options //(TODO LATER) add a way to change the config.json from the app or at least show all the options
} else if (vaultSelected == "Quit (Ctrl+C)") { } else if (strcmp(vaultSelected,"Quit (Ctrl+C)") == 0) {
if (debug) {printf("\e[0;32m[DEBUG]\e[0m The program was exited.\n");} if (debug) {printf("\e[0;32m[DEBUG]\e[0m The program was exited.\n");}
shouldExit = 1; shouldExit = 1;
} }