Makefile 1.86 KB
Newer Older
Edward Vigmond's avatar
Edward Vigmond committed
1
2
HOSTMACHINE := $(shell uname)

Edward Vigmond's avatar
Edward Vigmond committed
3
HDF5API_ROOT  := ./hdf5api
4

5
6
FLTK_INC      := $(shell fltk-config --use-glut --use-gl --cxxflags)
FLTK_LD_FLAGS := $(shell fltk-config --use-images --use-glut --use-gl --ldflags)
7
COMMON_INC    := -I. -O0 -g -DOBJ_CLASS -D_REENTRANT -MMD -DNOMINMAX  -fopenmp
8

9
#HDF5=1
10
ifdef HDF5
Edward Vigmond's avatar
Edward Vigmond committed
11
LIB_CH5       := (HDF5_ROOT)/lib/libch5.a
12
13
14
15
16
17
LIB_HDF5      := -lch5 -lhdf5 -lhdf5_hl 
COMMON_INC    += -DUSE_HDF5
else
LIB_CH5       := 
LIB_HDF5      := 
endif
Edward Vigmond's avatar
Edward Vigmond committed
18

19
COMMON_LIBS    = -lpng -lpthread -lm -lz $(LIB_HDF5) 
Edward Vigmond's avatar
Edward Vigmond committed
20

21
LIBS     = -L$(HDF5API_ROOT)/lib  -lglut $(FLTK_LD_FLAGS) $(COMMON_LIBS)
22
LDFLAGS  =  -fopenmp
23
CXXFLAGS =  -I$(HDF5API_ROOT)/src $(FLTK_INC) $(COMMON_INC)
Edward Vigmond's avatar
Edward Vigmond committed
24

Edward Vigmond's avatar
Edward Vigmond committed
25
26
27
28
CPPFLAGS = $(CFLAGS) -g
ifdef ENABLE_LOGGING
CPPFLAGS += -DLOGGING_ENABLED
endif
Edward Vigmond's avatar
Edward Vigmond committed
29

30
31
32
33
34
FLTK_SOURCES = $(wildcard *.fl)
OBJS = $(FLTK_SOURCES:.fl=.o)\
	$(patsubst %.cc,%.o,$(wildcard *.cc))\
	$(patsubst %.c,%.o,$(wildcard *.c))\
	$(patsubst %.C,%.o,$(wildcard *.C))
35

36
37
38
39
#the files in OS_files contain OSMESA dependent clauses
OS_files= main.o TBmeshWin.o
OS_OBJS=$(filter-out $(OS_files),$(OBJS)) $(OS_files:.o=_os.o)

40
all: meshalyzer
Edward Vigmond's avatar
Edward Vigmond committed
41
42

meshalyzer: $(LIB_CH5) $(FLTK_SOURCES:.fl=.cc) $(OBJS) $(LIB_CH5)
43
	$(CXX) $(LDFLAGS) -o meshalyzer $(sort $(OBJS)) $(LIBS)
Edward Vigmond's avatar
Edward Vigmond committed
44
	fltk-config --post meshalyzer
Edward Vigmond's avatar
Edward Vigmond committed
45

46
47
48
49
mesalyzer: $(LIB_CH5) $(FLTK_SOURCES:.fl=.cc) $(OS_OBJS) $(LIB_CH5)
	$(CXX) $(LDFLAGS) -o mesalyzer $(sort $(OS_OBJS)) -lOSMesa $(LIBS)
	fltk-config --post mesalyzer

50
ifdef HDF5
Edward Vigmond's avatar
Edward Vigmond committed
51
$(LIB_CH5): 
52
53
	cd hdf5api && make all $(LIB_CH5) $(FLTK_SOURCES:.fl=.cc) $(OBJS) $(LIB_CH5)

54
endif
Edward Vigmond's avatar
Edward Vigmond committed
55

56
57
58
$(OS_files:.o=_os.o): %_os.o: %.cc
	$(CXX) $(CXXFLAGS) $(CPP_FLAGS) -D OSMESA -c -o $@  $<

Edward Vigmond's avatar
Edward Vigmond committed
59
clean:
60
	rm -rf $(FLTK_SOURCES:.fl=.h) $(FLTK_SOURCES:.fl=.cc) *.o *.d meshalyzer mesalyzer meshalyzer.app
Edward Vigmond's avatar
Edward Vigmond committed
61
62
63

utils: 
	cd utils && make all
Edward Vigmond's avatar
Edward Vigmond committed
64

Edward Vigmond's avatar
Edward Vigmond committed
65
66
docs: 
	doxygen Doxyfile
67
ifdef HDF5
Edward Vigmond's avatar
Edward Vigmond committed
68
	cd hdf5api && doxygen Doxyfile
69
endif
70

71
72
73
74
%.h %.cc: %.fl
	fluid -c $<

-include $(OBJS:.o=.d)
Edward Vigmond's avatar
Edward Vigmond committed
75
76
77

.PHONY: utils