aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-05-04 23:03:46 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-05-04 23:03:46 +0100
commitdca7a781545c1b16af76bbbcbd45f6d735c02587 (patch)
treeaf6f8fff657c84f09028c7a351ede00f30305fc9
parent3f55bafdeddd9893760c2e165756c7bbc575b027 (diff)
downloadtr8vm-dca7a781545c1b16af76bbbcbd45f6d735c02587.tar.gz
tr8vm-dca7a781545c1b16af76bbbcbd45f6d735c02587.zip
Make the stb_image implementation a C module
-rw-r--r--Makefile9
-rw-r--r--stb_image.c3
-rw-r--r--tr8as.c2
3 files changed, 9 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 2bc7a3b..c83ded3 100644
--- a/Makefile
+++ b/Makefile
@@ -12,12 +12,15 @@ all: tr8as tr8vm
tr8vm: tr8vm.c vm.o vm.h
$(CC) -std=c99 $(CFLAGS) `$(SDL2_CONFIG) --cflags` $< vm.o `$(SDL2_CONFIG) --libs` $(LIBS) -o $@
-tr8as: tr8as.c
- $(CC) -std=c99 $(CFLAGS) -DDO_MAIN $< -o $@ -lm
+tr8as: tr8as.c stb_image.o
+ $(CC) -std=c99 $(CFLAGS) -DDO_MAIN $< stb_image.o -o $@ -lm
vm.o: vm.c vm.h
$(CC) -c -std=c89 $(CFLAGS) $< -o $@
+stb_image.o: stb_image.c stb_image.h
+ $(CC) -c -std=c99 $(CFLAGS) $< -o $@
+
example: example.tr8 tr8vm
./tr8vm example.tr8
@@ -25,7 +28,7 @@ example.tr8: example.asm tr8as
./tr8as example.asm example.tr8
clean:
- rm -f tr8as tr8vm example.tr8
+ rm -f tr8as tr8vm example.tr8 *.o
.PHONY: clean all example
diff --git a/stb_image.c b/stb_image.c
new file mode 100644
index 0000000..f81a87a
--- /dev/null
+++ b/stb_image.c
@@ -0,0 +1,3 @@
+#define STB_IMAGE_IMPLEMENTATION
+#define STBI_ONLY_PNG
+#include "stb_image.h"
diff --git a/tr8as.c b/tr8as.c
index ab471e5..a02f696 100644
--- a/tr8as.c
+++ b/tr8as.c
@@ -29,8 +29,6 @@
#include <strings.h>
#include <ctype.h>
-#define STB_IMAGE_IMPLEMENTATION
-#define STBI_ONLY_PNG
#include "stb_image.h"
#define MAX_LINE 1024