2022-03-05 13:23:24 -05:00
|
|
|
BASE_UXN := src/uxn
|
|
|
|
SRC_DIR ?= src
|
|
|
|
BUILD_DIR ?= build
|
2022-03-05 17:01:59 -05:00
|
|
|
SRC_MAIN ?= $(SRC_DIR)/main.c
|
2022-03-05 13:23:24 -05:00
|
|
|
EXE_NAME ?= uxnfb
|
|
|
|
BIN := $(BUILD_DIR)/$(EXE_NAME)
|
|
|
|
UXN_HEAD := $(BASE_UXN)/src/uxn.h
|
|
|
|
TAL_SRC ?= $(BASE_UXN)/projects/examples/devices/screen.tal
|
|
|
|
UXN_ROM ?= $(BUILD_DIR)/rom.rom
|
|
|
|
UXN_ASM ?= $(BUILD_DIR)/uxnasm
|
|
|
|
KBD_PATH ?= /dev/input/event1
|
|
|
|
MOUSE_PATH ?= /dev/input/mice
|
|
|
|
C_DEFINES := -DKBD_PATH=\"$(KBD_PATH)\" -DMOUSE_PATH=\"$(MOUSE_PATH)\"
|
2022-03-03 03:42:47 -05:00
|
|
|
|
|
|
|
CC ?= cc
|
2022-03-05 14:34:36 -05:00
|
|
|
CFLAGS := -Wall -Wextra -pedantic -static
|
2022-03-03 03:42:47 -05:00
|
|
|
|
|
|
|
REL_FLAGS := -DNDEBUG -O2
|
|
|
|
DEB_FLAGS := -DDEBUG -O0 -g
|
|
|
|
|
|
|
|
DEBUG ?= 0
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
CFLAGS += $(DEB_FLAGS)
|
|
|
|
else ifeq ($(DEBUG), 2)
|
|
|
|
CFLAGS += $(DEB_FLAGS) -fsanitize=address
|
|
|
|
else
|
|
|
|
CFLAGS += $(REL_FLAGS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: build run clean
|
|
|
|
|
|
|
|
main: $(BIN)
|
|
|
|
|
2022-03-04 09:09:58 -05:00
|
|
|
$(BIN): $(SRC_MAIN) $(BUILD_DIR) $(UXN_HEAD)
|
2022-03-05 13:23:24 -05:00
|
|
|
$(CC) $(CFLAGS) -o $(BIN) $(SRC_MAIN) $(C_DEFINES)
|
2022-03-03 03:42:47 -05:00
|
|
|
|
|
|
|
$(BUILD_DIR):
|
|
|
|
mkdir -p $(BUILD_DIR)
|
|
|
|
|
2022-03-04 09:09:58 -05:00
|
|
|
$(UXN_HEAD):
|
2022-03-04 08:16:32 -05:00
|
|
|
git submodule init
|
|
|
|
git submodule update
|
|
|
|
|
2022-03-04 12:20:16 -05:00
|
|
|
$(UXN_ASM): $(UXN_HEAD)
|
|
|
|
$(CC) $(CFLAGS) -o $(UXN_ASM) $(BASE_UXN)/src/uxnasm.c
|
|
|
|
|
|
|
|
$(UXN_ROM): $(UXN_ASM)
|
|
|
|
./$(UXN_ASM) $(TAL_SRC) $(UXN_ROM)
|
|
|
|
|
|
|
|
run: $(BIN) $(UXN_ROM)
|
2022-03-03 04:28:22 -05:00
|
|
|
# NOTE: This should probably be done on the C code.
|
2022-03-04 12:20:16 -05:00
|
|
|
# echo 0 > /sys/class/graphics/fbcon/cursor_blink
|
|
|
|
./$(BIN) $(UXN_ROM)
|
2022-03-03 03:42:47 -05:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(BUILD_DIR)
|