firmware: add build rules for RegGen-generated headers

Change-Id: I86ff1a39aec1ee428abd6464483ae3732fdf9196
This commit is contained in:
Aidan MacDonald 2025-12-21 20:01:54 +00:00
parent a8d792c248
commit 44afcc8cbe
4 changed files with 35 additions and 0 deletions

View file

@ -14,6 +14,9 @@ INCLUDES += -I$(FIRMDIR)/libc/include
endif endif
include $(FIRMDIR)/asm/asm.make include $(FIRMDIR)/asm/asm.make
ifneq ($(filter reggen,$(TOOLSET)),)
include $(FIRMDIR)/reggen/reggen.make
endif
FIRMLIB_SRC += $(call preprocess, $(FIRMDIR)/SOURCES) FIRMLIB_SRC += $(call preprocess, $(FIRMDIR)/SOURCES)
FIRMLIB_OBJ := $(call c2obj, $(FIRMLIB_SRC)) FIRMLIB_OBJ := $(call c2obj, $(FIRMLIB_SRC))

1
firmware/reggen/SOURCES Normal file
View file

@ -0,0 +1 @@
// Intentionally empty file.

View file

@ -0,0 +1,27 @@
# __________ __ ___.
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/
# $Id$
#
REGGEN_SRC := $(call preprocess, $(FIRMDIR)/reggen/SOURCES)
REGGEN_STAMP := $(foreach regs,$(REGGEN_SRC),$(notdir $(regs)))
REGGEN_STAMP := $(patsubst %.regs,$(BUILDDIR)/regs/%/_stamp,$(REGGEN_STAMP))
$(BUILDDIR)/regs/%/_stamp: $(FIRMDIR)/reggen/%.regs $(TOOLSDIR)/reggen
$(SILENT)rm -rf $(@D)
$(SILENT)mkdir -p $(@D)
$(call PRINTS,REGGEN $(subst $(ROOTDIR)/,,$<))$(TOOLSDIR)/reggen $< -rh reggen.h -ig $(subst -,_,$*) -o $(@D)
$(SILENT)touch $@
# 'touch' header to propagate dependency on reggen.h through to
# users of the generated headers. Might be a better way to do
# this, but this seems to be adequate.
$(BUILDDIR)/regs/%.h: $(REGGEN_STAMP) $(FIRMDIR)/export/reggen.h
$(SILENT)touch $@
CLEANOBJS += $(BUILDDIR)/regs

View file

@ -41,6 +41,10 @@ $(TOOLSDIR)/convttf: $(TOOLSDIR)/convttf.c
$(SILENT)$(HOSTCC) $(TOOLSFLAGS) -lm -O2 -Wall -g $+ -o $@ \ $(SILENT)$(HOSTCC) $(TOOLSFLAGS) -lm -O2 -Wall -g $+ -o $@ \
`pkg-config --cflags --libs freetype2` `pkg-config --cflags --libs freetype2`
$(TOOLSDIR)/reggen: $(wildcard $(TOOLSDIR)/reggen_src/*.c)
$(call PRINTS,CC $(@F))
$(SILENT)$(HOSTCC) $(TOOLSFLAGS) -Wall -Wextra -O2 -g -o $@ $+
# implicit rule for simple tools # implicit rule for simple tools
$(TOOLSDIR)/%: $(TOOLSDIR)/%.c $(TOOLSDIR)/%: $(TOOLSDIR)/%.c
$(call PRINTS,CC $(subst $(ROOTDIR)/,,$@)) $(call PRINTS,CC $(subst $(ROOTDIR)/,,$@))