fx9860g and fxcg50 2D math rendering library with support for TeX syntax.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

94 lines
1.7 KiB

#! /usr/bin/make -f
# Require the configuration file if we're not cleaning
ifeq "$(filter clean distclean,$(MAKECMDGOALS))" ""
ifeq ($(wildcard Makefile.cfg),)
$(error "Makefile.cfg is missing. Did you ./configure ?")
endif
endif
include Makefile.cfg
include config/$(PLATFORM).cfg
parser := src/TeX.y
src := $(wildcard src/*.c) $(wildcard src/platform/$(PLATFORM).c)
obj := $(src:src/%.c=build/%.c.o) $(parser:src/%.y=build/%.tab.c.o)
cflags := -Wall -Wextra -std=c11 -I include -D_GNU_SOURCE $(CFLAGS)
dflags = -MMD -MT $@ -MF $(@:.o=.d) -MP
bflags := -L C
#
# Building
#
all: $(TARGET)
TeX-SDL TeX-cli: $(obj)
$(CC) $^ -o $@ $(cflags) $(LDFLAGS)
libTeX-fx.a libTeX-cg.a: $(obj)
$(AR) rcs $@ $^
build/%.c.o: src/%.c Makefile.cfg
@ mkdir -p $(dir $@)
$(CC) -c $< -o $@ $(dflags) $(cflags)
build/%.tab.c.o: build/%.tab.c
@ mkdir -p $(dir $@)
$(CC) -c $< -o $@ $(dflags) $(cflags)
build/%.tab.c: src/%.y Makefile.cfg
@ mkdir -p $(dir $@)
bison $< -o $@ $(bflags)
#
# Dependency management
#
.PRECIOUS: build/%.tab.c
.PRECIOUS: build/%.d
build/%.d: ;
include $(wildcard build/*.d)
#
# Install
#
ifeq "$(PLATFORM)" "fx9860g"
install: $(TARGET)
install -d $(PREFIX)
install $(TARGET) -m 644 $(PREFIX)
cp -r include/TeX $(PREFIX)/include
uninstall: $(TARGET)
rm -f $(PREFIX)/$(TARGET)
rm -rf $(PREFIX)/include/TeX
endif
ifeq "$(PLATFORM)" "fxcg50"
install: $(TARGET)
install -d $(PREFIX)
install $(TARGET) -m 644 $(PREFIX)
cp -r include/TeX $(PREFIX)/include
uninstall: $(TARGET)
rm -f $(PREFIX)/$(TARGET)
rm -rf $(PREFIX)/include/TeX
endif
#
# Cleaning
#
clean:
rm -rf build
distclean: clean
rm -f Makefile.cfg
rm -f TeX-cli TeX-SDL libTeX-fx.a libTeX-cg.a
.PHONY: all clean distclean install
.SUFFIXES: