payredu

[WIP] Cross-platform ledger GUI written in c99

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
57 
GENERAL_FLAGS = # -fPIC

GUI_LDFLAGS=-lglfw -lGL

CFLAGS:=${GENERAL_FLAGS} -I.
LDFLAGS:=${GENERAL_FLAGS}

# if ${CC}
${CC}_CFLAGS := -O0 -g -Wpedantic -Werror -lm
${CC}_out := -o
${CC}_exe_out := ${${CC}_out}
# else cl
cl_CFLAGS := /nologo /WX /W3 /D_CRT_SECURE_NO_WARNINGS
cl_exe_ext := .exe
cl_out := /Fo:
cl_exe_out := /Fe:

# consolidate
CFLAGS += ${${CC}_CFLAGS}
out := ${${CC}_out}

# gmake hack
^ ?= ${.ALLSRC}

export LD_LIBRARY_PATH=.

payredu${${CC}_exe_ext}: payredu.c libbook.a
	${CC} ${${CC}_exe_out}$@ ${CFLAGS} ${LDFLAGS} $^

.c.o:
	${CC} ${CFLAGS} -c $^ ${out}$@

bal:
	#ledger -f october-2023.txt bal

balance: balance.c ledger.h

hot: hot.c libbook.so

libbook.a: book.o account.o
	ar cr $@ $^

libbook.so: book.o  account.o
	${CC} -shared -Wl,-soname,$@ -o $@ $^

refresh:
	git ls-files | entr sh hot.sh

format:
	indent -psl -pal --use-tabs -ts4 -br -brs -ce -cli0 book.c

include tests/tests.mk

RM?=rm -f

clean:
	-${RM} payredu payredu.exe *.a *.so *.o *.obj hot hot.exe $(TESTS)