Files
secondo/Algebras/TopRel/makefile
2026-01-23 17:03:45 +08:00

107 lines
3.5 KiB
Makefile

########################################################################
#
# SECONDO makefile for TopRel Algebra C++
#
########################################################################
# include global definitions
include ../../makefile.env
# This is the only macro which must be changed in order to
# define a module name for an algebra. The rest of this makefile
# should work for nearly every algebra.
MODNAME = TopRelAlgebra
# Use the mace CCFLAGS to add special compiler flags if needed.
# In this case the defaults are sufficient
CCFLAGS = $(DEFAULTCCFLAGS) -I../FText -I../Rectangle -I../Spatial
# The next rule will create a ".o" file for every ".cpp" file and
# creates a "lib$(MODNAME).a" file in the secondo/lib dir. Rules
# for creating ".dep" files and ".o" files are defined in makefile.env
.PHONY: all
all: $(OBJECTS) $(LIBOBJ)
OBJECTS += TreeParser.o TreeLex.o Tree.o
# DEP_FILES is a macro defined in makefile.env. It will contain
# a list of files which are generated by the compiler to
# detect dependencies to other code files.
ifneq ($(MAKECMDGOALS),clean)
-include $(DEP_FILES)
endif
.PHONY: deps
deps: $(DEP_FILES)
# The rule below creates a library file. Maybe as shared or as static
# object. In case of a shared object all dependencies to other libraries
# must be defined. However, currently the command make shared=yes will
# not work. But in principle every algebra implementor has to define dependencies
# to other libraries here, since the make procedure does not know how to do this
# automatically.
$(LIBOBJ): $(OBJECTS)
ifeq ($(shared),yes)
# ... as shared object
$(LD) $(LDFLAGS) -o $(LIBOBJ) $(LDOPT) $(OBJECTS) -L$(LIBDIR) -lStandardAlgebra $(SDBLIB) $(TOOLLIB) $(DEFAULTLIB)
else
# ... as static library
$(AR) -r $(LIBOBJ) $(OBJECTS)
endif
TreeParser.o: TreeParser.y.c
$(CC) -fPIC -c -o TreeParser.o TreeParser.y.c
TreeParser.y.c: TreeParser.y
$(YACC) -d -o TreeParser.y.c TreeParser.y
TreeLex.o: TreeLex.c
$(CC) -fPIC -c -o TreeLex.o TreeLex.c
TreeLex.c: TreeLex.l TreeParser.y.c
$(LEX) -oTreeLex.c TreeLex.l
Tree.o: Tree.c Tree.h makefile
$(CC) -fPIC -c -o Tree.o Tree.c
.PHONY: pdf
pdf: TopRelAlgebra.doc.pdf
TopRelAlgebra.doc.pdf: TopRelAlgebra.doc.dvi
dvipdfm -p a4 TopRelAlgebra.doc.dvi
TopRelAlgebra.doc.dvi: TopRelAlgebra.doc
pd2dvi TopRelAlgebra.doc
TopRelAlgebra.doc: ../../include/TopRel.h TopRelAlgebra.cpp Tree.h Tree.c TreeLex.l TreeParser.y makefile
@cat ../../include/TopRel.h >TopRelAlgebra.doc
@echo -e '\n/*\n[\\f]\n\n*/\n' >> TopRelAlgebra.doc
@cat TopRelAlgebra.cpp | sed -e "s#^\[toc\]##g" -e "s#^\[title\]##g" >> TopRelAlgebra.doc
@echo -e '\n/*\n[\\f]\n\n*/\n' >> TopRelAlgebra.doc
@cat Tree.h | sed -e "s#^\[toc\]##g" -e "s#^\[title\]##g" >> TopRelAlgebra.doc
@echo -e '\n/*\n[\\f]\n\n*/\n' >> TopRelAlgebra.doc
@cat Tree.c | sed -e "s#^\[toc\]##g" -e "s#^\[title\]##g" >> TopRelAlgebra.doc
@echo -e '\n/*\n[\\f]\n\n*/\n' >> TopRelAlgebra.doc
@cat TreeLex.l | sed -e "s#^\[toc\]##g" -e "s#^\[title\]##g" >> TopRelAlgebra.doc
@echo -e '\n/*\n[\\f]\n\n*/\n' >> TopRelAlgebra.doc
@cat TreeParser.y | sed -e "s#^\[toc\]##g" -e "s#^\[title\]##g" >> TopRelAlgebra.doc
@echo -e '\n/*\n[\\f]\n\n*/\n' >> TopRelAlgebra.doc
@echo -e "\n\n/*\n1 The Makefile\n\n*/\n" >> TopRelAlgebra.doc
@cat makefile >>TopRelAlgebra.doc
# remove all generated stuff
.PHONY: clean
clean:
$(RM) $(DEP_FILES) $(OBJECTS) $(LIBOBJ)
$(RM) -f P TreeParser.o TreeParser.y.c TreeLex.o TreeLex.c Tree.o
$(RM) -f TreeParser.y.h
$(RM) -f TopRelAlgebra.doc.*
$(RM) -f TopRelAlgebra.doc