remove rust/cargo from compilation

it has become clear that incorperating rust in this project was a
mistake, since I don't understand it well enough for it to be useful,
and at this rate it'd be faster to use GLFW in C than in rust.
This commit is contained in:
Quinn
2025-04-12 20:52:35 +02:00
committed by Quinn
parent 87117931f7
commit 401854002f
5 changed files with 8 additions and 100 deletions

View File

@@ -13,18 +13,11 @@ CSTD := c17
CFLAGS := $(shell pkg-config --cflags glfw3) -Wall -Wextra -Wpedantic -Wno-pointer-arith -static
LDFLAGS := $(shell pkg-config --libs glfw3)
# Rust compiler options
RUSTC := cargo rustc
RSFLAGS :=
ifeq ($(DEBUG),1)
CFLAGS += -g -Og
RSOUT := debug
PROF := dbg
else
CFLAGS += -DNDEBUG -O2 -Werror
RSOUT := release
RSFLAGS := --release
PROF := rel
endif
@@ -32,13 +25,9 @@ ifneq ($(MAKECMDGOALS),clean)
ifeq ($(ARCH),linux-x86_64)
CFLAGS += -target x86_64-pc-linux-gnu
LDFLAGS += -target x86_64-pc-linux-gnu
RSFLAGS += --target=x86_64-unknown-linux-gnu
RSOUT := target/x86_64-unknown-linux-gnu/$(RSOUT)
else ifeq ($(ARCH),win-x86_64)
CFLAGS += -target x86_64-pc-windows-gnu
LDFLAGS += -target x86_64-pc-windows-gnu
RSFLAGS += --target=x86_64-pc-windows-gnu
RSOUT := target/x86_64-pc-windows-gnu/$(RSOUT)
EXT := .exe
else
$(error you must set the ARCH environment variable to one of these: 'linux-x86_64' 'win-x86_64')
@@ -53,10 +42,6 @@ BIN := $(DIR_BIN)/$(NAME)$(EXT)
C_SRC := $(shell find src/ -name '*.c')
C_OBJ := $(patsubst src/%,$(DIR_OBJ)/%,$(C_SRC:.c=.o))
C_DEP := $(C_OBJ:.o=.d)
RS_SRC := $(shell find src/ -name '*.rs')
RS_LIB := $(RSOUT)/libmcaselector_lite.a
RS_DEP := $(RSOUT)/libmcaselector_lite.d
RSOUT :=
endif
define log_col
@@ -73,20 +58,18 @@ run: compile
compile: compile_commands.json $(BIN)
clean:
@$(call warn,"cleaning!")
rm -rf bin/ obj/ target/ compile_commands.json
rm -rf bin/ obj/ compile_commands.json
# TODO: write a structure for the unit tests in this
# create the binary (linking step)
$(BIN): $(C_OBJ) $(RS_LIB)
@$(call mesg,"RUSTC: '$(RUSTC)'")
$(BIN): $(C_OBJ)
@$(call mesg,"CC: '$(CC)'")
@$(call mesg,"CFLAGS: '$(CFLAGS)'")
@$(call mesg,"RSFLAGS: '$(RSFLAGS)'")
@$(call mesg,"LDFLAGS: '$(LDFLAGS)'")
@$(call comp,"linking to: '$@'")
@mkdir -p $(@D)
@$(CC) $(LDFLAGS) -o $@ $(C_OBJ) $(RS_LIB)
@$(CC) $(LDFLAGS) -o $@ $(C_OBJ)
@$(call warn,"current profile: '$(PROF)'")
# create .o and .d files for C sources
@@ -95,10 +78,6 @@ $(DIR_OBJ)/%.o: src/%.c
@mkdir -p $(@D)
@$(CC) $(CFLAGS) -c -MD -MP -std=$(CSTD) -x c -o $@ $<
# create .o and .d files for the entire rust codebase
$(RS_LIB): $(RS_SRC)
$(RUSTC) $(RSFLAGS)
# update compile commands if the makefile has been updated (for linting)
ifneq ($(shell which bear),)
compile_commands.json: makefile
@@ -114,4 +93,3 @@ endif
# include the dependencies
-include $(C_DEP)
-include $(RS_DEP)