payredu

[WIP] Cross-platform ledger GUI written in c99

commit 9e1e34fe2f7f279aac174d5f59f1e9e677a83d2b
parent 407405137373f77aa02a03e56d1d127c83c6d846
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Thu, 11 Apr 2024 21:33:54 +0530

Use gmake's $^ and assign $_ to it, if bmake
2 files changed, 12 insertions(+), 12 deletions(-)
M
HACKING
|
2
+-
M
Makefile
|
22
+++++++++++-----------
diff --git a/HACKING b/HACKING
@@ -19,7 +19,7 @@ Makefile
 --------
 This project strives to use the same Makefile to work on both gmake and bmake.
 
-If you want to add any ${CC} specific flags, check the part under "#if msvc" in Makefile.
+If you want to add any ${CC} specific flags, check the part under "#if ${CC}" in Makefile.
 
 commit.c
 --------
diff --git a/Makefile b/Makefile
@@ -5,30 +5,30 @@ GUI_LDFLAGS=-lglfw -lGL
 CFLAGS:=${GENERAL_FLAGS} -I.
 LDFLAGS:=${GENERAL_FLAGS}
 
-# if msvc
+# 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:
-#  else
-_CFLAGS := -O0 -g -Wpedantic -Werror -lm
-_out := -o
-_exe_out := ${_out}
 
 # consolidate
 CFLAGS += ${${CC}_CFLAGS}
 out := ${${CC}_out}
 
 # gmake hack
-_ ?= $^
+^ ?= $_
 
 export LD_LIBRARY_PATH=.
 
-payredu${${cl}_exe_ext}: payredu.c libbook.a
-	${CC} ${${CC}exe_out}$@ ${CFLAGS} ${LDFLAGS} $_ 
+payredu${${CC}_exe_ext}: payredu.c libbook.a
+	${CC} ${${CC}_exe_out}$@ ${CFLAGS} ${LDFLAGS} $^
 
 .c.o:
-	${CC} ${CFLAGS} -c $_ ${out}$@
+	${CC} ${CFLAGS} -c $^ ${out}$@
 
 bal:
 	#ledger -f october-2023.txt bal

@@ -38,10 +38,10 @@ balance: balance.c ledger.h
 hot: hot.c libbalance.so
 
 libbook.a: book.o account.o
-	ar cr $@ $_
+	ar cr $@ $^
 
 libbook.so: book.o  account.o
-	${CC} -shared -Wl,-soname,$@ -o $@ $_
+	${CC} -shared -Wl,-soname,$@ -o $@ $^
 
 refresh:
 	git ls-files | entr sh hot.sh