# Makefile for the Mathomatic symbolic math library and library test.
# Currently uses gcc only options in CFLAGS, just remove them for other C compilers.
# Be sure to "make clean" between using different makefiles.

VERSION		= `cat VERSION`
CFLAGS		+= -Wuninitialized -Wshadow -Wformat -Wparentheses -Wcast-align # gcc specific flags
CFLAGS		+= -O -DLIBRARY -DUNIX -DVERSION=\"$(VERSION)\" # general cc flags
LDFLAGS		+= 
LIBS		+= -lm

prefix		?= /usr/local

AOUT		= mathomatic # The name of the library test executable to create.
LIB		= libmathomatic.a # The symbolic math library name.

OBJECTS		= lib/lib.o globals.o am.o solve.o help.o parse.o cmds.o simplify.o \
		  factor.o super.o unfactor.o poly.o diff.o integrate.o \
		  complex.o complex_lib.o list.o gcd.o factor_int.o

all: $(AOUT)
	@echo Make completed.

lib $(LIB): $(OBJECTS)
	ar cr $(LIB) $(OBJECTS)
	ranlib $(LIB)

$(OBJECTS): lib/mathomatic.h includes.h am.h externs.h complex.h proto.h VERSION

$(AOUT): lib/test.o $(LIB)
	$(CC) $(LDFLAGS) lib/test.o $(LIB) $(LIBS) -o $(AOUT)

install:
	install -m 0644 $(LIB) $(prefix)/lib
	install -m 0644 lib/mathomatic.h $(prefix)/include

clean:
	rm -f *.o
	rm -f lib/*.o

flush: clean
	rm -f $(AOUT)
	rm -f *.a
	rm -f lib/*.a


syntax highlighted by Code2HTML, v. 0.9.1