payredu

[WIP] Cross-platform ledger GUI written in c99

commit 2a0b60d627b59c3a4eff1f72306707e246bfafb8
parent 5351f865cabf622fb0d10077a0c838439a7e8e49
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Sun, 17 Mar 2024 06:47:47 +0000

Fix the Makefile for NetBSD

Make GUI optional by adding the ENABLE_GUI option

Fix type in README
3 files changed, 17 insertions(+), 14 deletions(-)
M
Makefile
|
20
++++++++++----------
M
README
|
9
+++++----
M
book.c
|
2
++
diff --git a/Makefile b/Makefile
@@ -1,5 +1,6 @@
 GENERAL_FLAGS=-fPIC
-LDFLAGS:=$(GENERAL_FLAGS) -lglfw -lGL -lm
+GUI_LDFLAGS=-lglfw -lGL
+LDFLAGS:=$(GENERAL_FLAGS)  -lm
 CFLAGS:=$(GENERAL_FLAGS) -O0 -I. -g -Werror #-Wpedantic
 export LD_LIBRARY_PATH=.
 

@@ -7,25 +8,24 @@ export LD_LIBRARY_PATH=.
 
 CC=gcc
 
-%: %.c libbook.so
-	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) libbook.so $<
+payredu: payredu.c libbook.a
+	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $> -L. -lbook
 
-%.o: %.c
-	$(CC) $(CFLAGS) -c $< -o $@
+.o: .c
+	$(CC) $(CFLAGS) -c $> -o $@
 
 bal:
-	ledger -f october-2023.txt bal
+	#ledger -f october-2023.txt bal
 
 balance: balance.c ledger.h
 
 hot: hot.c libbalance.so
 
-libbook.a: book.c book.h account.c account.h
+libbook.a: book.o account.o
+	ar cr $@ $>
 
 libbook.so: book.o  account.o
-	$(CC) -shared -Wl,-soname,$@ -o $@ $^
-
-payredu: payredu.c libbook.so
+	$(CC) -shared -Wl,-soname,$@ -o $@ $>
 
 refresh:
 	git ls-files | entr sh hot.sh
diff --git a/README b/README
@@ -3,7 +3,7 @@ payredu
 பேரேடு
 ======
 
-payredu is a cross-platform frontend to ledger(pta) with emphasis on simplicity. perudu means ledger in Tamil. It is written in c99 and works on top of nuklear making it lightweight and fast.
+payredu is a cross-platform frontend to ledger(pta) with emphasis on simplicity. payredu means ledger in Tamil. It is written in c99 and works on top of nuklear making it lightweight and fast.
 
 NOTE: The quality of the software is beta in the least, it's still in development.
 

@@ -15,7 +15,7 @@ To build and run,
 Why payredu when ledger-cli exists?
 ------------------------------------
 
-ledger-cli itself pretty lightweight but it has a handful of dependencies and features which I don't particularly care about.
+ledger-cli by itself is pretty lightweight but it has a handful of dependencies and features which I don't particularly care about.
 
 payredu follows a very suckless approach to ledger and does NOT provide some of the advanced features ledger provides.
 

@@ -39,6 +39,7 @@ Non-Goals
 Build
 -----
 
-	make
+	make hot
 
-will generate 'hotbook' which you can use to start the hot-reload functionality, this can be expected to be removed in the future.
+will generate 'hot' which can be used to test the hot-reload functionality with GUI for development.
+This is may be removed in feature to provide only a CUI interface.
diff --git a/book.c b/book.c
@@ -9,6 +9,7 @@
 
 #include <unistd.h>
 
+#ifdef ENABLE_GUI
 #include <GLFW/glfw3.h>
 #define NK_INCLUDE_FIXED_TYPES
 #define NK_INCLUDE_STANDARD_IO

@@ -22,6 +23,7 @@
 #define NK_KEYSTATE_BASED_INPUT
 #include <nuklear.h>
 #include <nuklear_glfw_gl2.h>
+#endif
 
 #define _XOPEN_SOURCE
 #include <time.h>