uxnfb/Makefile

44 lines
794 B
Makefile
Raw Normal View History

2022-03-03 03:42:47 -05:00
SRC_DIR ?= src
BUILD_DIR ?= build
SRC_MAIN ?= $(SRC_DIR)/main.c
EXE_NAME ?= fbtest
BIN := $(BUILD_DIR)/$(EXE_NAME)
2022-03-04 08:16:32 -05:00
BASE_UXN := src/uxn/src/uxn.h
2022-03-03 03:42:47 -05:00
CC ?= cc
CFLAGS := -Wall -Wextra -pedantic
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 08:16:32 -05:00
$(BIN): $(SRC_MAIN) $(BUILD_DIR) $(BASE_UXN)
2022-03-03 03:42:47 -05:00
$(CC) $(CFLAGS) -o $(BIN) $(SRC_MAIN)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
2022-03-04 08:16:32 -05:00
$(BASE_UXN):
git submodule init
git submodule update
2022-03-03 03:42:47 -05:00
run: $(BIN)
# NOTE: This should probably be done on the C code.
echo 0 > /sys/class/graphics/fbcon/cursor_blink
2022-03-03 03:42:47 -05:00
./$(BIN)
clean:
rm -rf $(BUILD_DIR)