From 8589b2a73082ae1d7e87b71f8f1774f1a1d4fe7f Mon Sep 17 00:00:00 2001 From: hkc Date: Thu, 3 Oct 2024 19:25:34 +0300 Subject: [PATCH] Build stb_* stuff into a separate blob Speeds up build process a little bit because we don't have to build it every single time --- Makefile | 5 ++++- img2cpi.c | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 1f891c5..592ddc1 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,12 @@ LDLIBS += -lm all: img2cpi cpi2png wsvpn -img2cpi: img2cpi.c cc-common.o +img2cpi: img2cpi.c cc-common.o dependencies/stb/stb_image.o dependencies/stb/stb_image_resize2.o $(CC) $(LDFLAGS) $^ $(LDLIBS) -o "$@" +dependencies/stb/%.o: dependencies/stb/%.h + $(CC) -DSTB_IMAGE_IMPLEMENTATION -DSTB_IMAGE_RESIZE_IMPLEMENTATION -DSTB_IMAGE_WRITE_IMPLEMENTATION -x c $^ -c -o "$@" + wsvpn: wsvpn.o dependencies/mongoose/mongoose.o $(CC) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o "$@" diff --git a/img2cpi.c b/img2cpi.c index cfe1d7c..743bc0a 100644 --- a/img2cpi.c +++ b/img2cpi.c @@ -1,8 +1,8 @@ // x-run: make img2cpi CC=clang // x-run: ~/scripts/runc.sh % -Wall -Wextra -lm --- ~/images/boykisser.png cpi-images/boykisser.cpi -#define STB_IMAGE_IMPLEMENTATION +#include +#include #include -#define STB_IMAGE_RESIZE_IMPLEMENTATION #include #include #include