summaryrefslogtreecommitdiff
path: root/Makefile
blob: 62b78a30a120d40e3156a8aed058896f2cc2b579 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# $Id$

CC = g++
CPPFLAGS += -D USE_64BITS_WORDS
CFLAGS = -O3 -g
CFLAGS += -Wall $$(pkg-config gtkmm-2.4 --cflags)
LIBS = 
HEADERS = mtx.h mtxinteger.h mtxrational.h mtxmatrix.h mtxexception.h \
          mtxdivbyzeroexception.h mtxsingularmatrixexception.h \
          mtxvalue.h mtxsymbol.h mtxlanguage.h mtxexpression.h \
          mtxwindow.h mtxhistory.h mtxentry.h
OBJECTS = mtxinteger.o mtxrational.o mtxmatrix.o \
          mtxexception.o mtxdivbyzeroexception.o \
          mtxsingularmatrixexception.o mtxvalue.o mtxsymbol.o \
          mtxlanguage.o mtxexpression.o

CLI_LIBS = -lreadline $(LIBS)
CLI_OBJECTS = main_cli.o $(OBJECTS)
CLI_BINARY = mtx_cli

GUI_LIBS = $$(pkg-config gtkmm-2.4 --libs) $(LIBS)
GUI_OBJECTS = main_gui.o mtxwindow.o mtxhistory.o mtxentry.o $(OBJECTS)
GUI_BINARY = mtx_gui

BINARIES = $(CLI_BINARY) $(GUI_BINARY)

DOXYGEN = doxygen
DOXYGEN_CONF = mtx.doxygen

.PHONY: bin all clean-doc clean

bin: $(BINARIES)

all: bin doc

$(CLI_BINARY): $(CLI_OBJECTS)
	$(CC) -o $(CLI_BINARY) $(CLI_OBJECTS) $(CLI_LIBS)

$(GUI_BINARY): $(GUI_OBJECTS)
	$(CC) -o $(GUI_BINARY) $(GUI_OBJECTS) $(GUI_LIBS)

%.o: %.cc $(HEADERS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) -c $<

doc: doc/html/index.html

doc/html/index.html: $(HEADERS)
	$(DOXYGEN) $(DOXYGEN_CONF)
	touch doc

clean-doc:
	rm -rf doc/html

clean: clean-doc
	rm -f $(BINARIES) *.o