I have an autotools project with a library that relies on machine-generated code for one of its source files. The program that generates the code is called mathgen. I've got mathgen as a NOINST program in Makefile.am.
Whenever one of mathgen's source files changes, automake needs to rebuild it, run the resulting executable to generate the library's source files, and then build the library. How can I tell it to do that? Is it even possible?
Here's the complete Makefile.am:
Code:
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = subdir-objects
AM_CXXFLAGS = -std=c++17 -Wall -O2 -g -DDEBUGMODE
AM_CPPFLAGS = -DSM_DEBUGMODE
LDADD = libstonem.a
lib_LIBRARIES = libstonem.a
libstonem_a_SOURCES = libstonem/StoneInterpreter.cpp \
libstonem/StoneResult.cpp \
libstonem/SM_MemoryCount.cpp \
libstonem/instructions/SM_ArithmeticOp.cpp \
libstonem/instructions/arithmetic_funcs/SM_ArithmeticOpFuncs.cpp \
libstonem/instructions/SM_Assign.cpp \
libstonem/instructions/SM_New.cpp \
libstonem/instructions/SM_Instruction.cpp \
libstonem/instructions/SM_Return.cpp \
libstonem/instructions/SM_ReturnValue.cpp \
libstonem/instructions/SM_Stack.cpp \
libstonem/variables/SM_Constant.cpp \
libstonem/variables/SM_FieldPointer.cpp \
libstonem/variables/SM_Pointer.cpp \
libstonem/variables/SM_Primitive.cpp \
libstonem/variables/SM_Variable.cpp
nobase_include_HEADERS = StoneMLib.hpp \
libstonem/SM_Definitions.hpp \
libstonem/SM_MemoryCount.hpp \
libstonem/SM_Tools.hpp \
libstonem/StoneInterpreter.hpp \
libstonem/StoneResult.hpp \
libstonem/instructions/SM_ArithmeticOp.hpp \
libstonem/instructions/SM_Assign.hpp \
libstonem/instructions/SM_New.hpp \
libstonem/instructions/SM_Instruction.hpp \
libstonem/instructions/SM_Return.hpp \
libstonem/instructions/SM_ReturnValue.hpp \
libstonem/instructions/SM_Stack.hpp \
libstonem/variables/SM_Constant.hpp \
libstonem/variables/SM_FieldPointer.hpp \
libstonem/variables/SM_Pointer.hpp \
libstonem/variables/SM_Primitive.hpp \
libstonem/variables/SM_Variable.hpp
noinst_PROGRAMS = mathgen
mathgen_SOURCES = mathfunctiongen/MathFunctionGen.cpp
bin_PROGRAMS = stonem
stonemdir = .
stonem_SOURCES = stonemachine/StoneMachine.cpp \
stonemachine/CommandParser.cpp
stonem_includedir = .
stonem_HEADERS = stonemachine/CommandParser.hpp