Compare commits

..

9 Commits

Author SHA1 Message Date
82ebe1f4d1 fix: use CC instead of LD, and deprecate LD
this is a bit confusing, since setting `LD=cc` would have the same
issue; `ld: -f may not be used without -shared`. So I've got no idea
what is going wrong, I guess it's something funky.
This works, so we shall stick with this.
2025-09-15 12:08:39 +02:00
5f3bd40a47 potato time.
this is quite upsetting.
2025-09-15 12:04:41 +02:00
158a7f8383 fix: don't use UNIX sh based ifs, instead opt for GNU Make.
This is more portable acorss machines
2025-09-15 12:04:41 +02:00
c32d1551c8 fix: regular xxd does not have -n, thus using some argument manipulation magic
On my main system I use `tinyxxd`, henceforth: "regular"
2025-09-15 12:04:41 +02:00
b04ce9998f fix: shader hex code is formatted incorrectly 2025-09-15 11:59:39 +02:00
218b98e684 fix: colour coding on error messages is incorrect 2025-09-15 11:59:39 +02:00
f20171c0d7 fix: using the linker for generating a .o file is a feature for only GNU ld.
Now utilising a process to generate a .c file using `xxd`, and compiling
those to object files.
2025-09-15 11:59:39 +02:00
3a7709c392 fix: use more accurate linker flags / calling. 2025-09-15 11:59:39 +02:00
ec36d8c475 add runner architecture to the action cache 2025-09-15 11:59:39 +02:00
2 changed files with 14 additions and 9 deletions

View File

@@ -25,12 +25,13 @@ jobs:
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y libwayland-dev libxkbcommon-dev xorg-dev cmake
sudo apt install -y libwayland-dev libxkbcommon-dev xorg-dev cmake xxd
- uses: actions/cache@v4
with:
path: lib/obj/
# I swear to god, if runner.arch displays x64 for x86_64, I will eat a potato.
# note: it is... fucking shit.
key: ${{runner.os}}_${{runner.arch}}-lib/obj-${{github.sha}}
restore-keys: ${{runner.os}}_${{runner.arch}}-lib/obj-
- run: make -Bj libs

View File

@@ -5,7 +5,6 @@
NAME = mcaselector-lite
DEBUG ?= 0
CC ?= cc
LD ?= cc
# setting default compilation flags
# some of which are able to be overwritten, others are always appended
@@ -49,11 +48,16 @@ all: bin/$(NAME)
libs: lib/obj/glfw/ lib/obj/libarchive/
test: bin/TEST_$(NAME); bin/TEST_$(NAME)
clean:
@[ -d bin/ ] && rm -vr bin/ || true
@[ -d obj/ ] && rm -vr obj/ || true
ifneq ($(wildcard bin/),)
rm -vr bin/
endif
ifneq ($(wildcard obj/),)
rm -vr obj/
endif
clean-libs:
@[ -d lib/obj/ ] && rm -vr lib/obj/ || true
ifneq ($(wildcard lib/obj/),)
rm -vr lib/obj/
endif
# compiles the libraries using cmake
lib/obj/%/: lib/%/
@@ -64,18 +68,18 @@ lib/obj/%/: lib/%/
bin/$(NAME): $(OBJ)
$(info [LD] $@)
@mkdir -p $(@D)
@$(LD) -o $@ $^ $(LDFLAGS) $(LDLIBS)
@$(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS)
# link together a testing binary
bin/TEST_$(NAME): $(TOBJ) $(filter-out obj/src/main.o,$(OBJ))
$(info [LD] $@)
@mkdir -p $(@D)
@$(LD) -o $@ $^ $(LDFLAGS) $(LDLIBS)
@$(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS)
obj/res/%.c: res/%
$(info [XXD] $@)
@mkdir -p $(@D)
@xxd -i -n $(patsubst res/%,%,$<) $< $@
@cd res/ && xxd -i $(patsubst res/%,%,$<) $(abspath $@)
obj/res/%.o: obj/res/%.c
$(info [CC] $@)