forked from hkc/cc-stuff
1
0
Fork 0

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
This commit is contained in:
Casey 2024-10-03 19:25:34 +03:00
parent 3cadd81a6b
commit 8589b2a730
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
2 changed files with 6 additions and 3 deletions

View File

@ -3,9 +3,12 @@ LDLIBS += -lm
all: img2cpi cpi2png wsvpn 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 "$@" $(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 wsvpn: wsvpn.o dependencies/mongoose/mongoose.o
$(CC) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o "$@" $(CC) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o "$@"

View File

@ -1,8 +1,8 @@
// x-run: make img2cpi CC=clang // x-run: make img2cpi CC=clang
// x-run: ~/scripts/runc.sh % -Wall -Wextra -lm --- ~/images/boykisser.png cpi-images/boykisser.cpi // x-run: ~/scripts/runc.sh % -Wall -Wextra -lm --- ~/images/boykisser.png cpi-images/boykisser.cpi
#define STB_IMAGE_IMPLEMENTATION #include <math.h>
#include <assert.h>
#include <stb/stb_image.h> #include <stb/stb_image.h>
#define STB_IMAGE_RESIZE_IMPLEMENTATION
#include <stb/stb_image_resize2.h> #include <stb/stb_image_resize2.h>
#include <argp.h> #include <argp.h>
#include <stdio.h> #include <stdio.h>