Makefile 2.61 KB
Newer Older
Edward Vigmond's avatar
Edward Vigmond committed
1
HOSTMACHINE := $(shell uname)
Edward Vigmond's avatar
Edward Vigmond committed
2
include make.conf
Edward Vigmond's avatar
Edward Vigmond committed
3

4 5
FLTK_INC      := $(shell fltk-config --use-glut --use-gl --cxxflags)
FLTK_LD_FLAGS := $(shell fltk-config --use-images --use-glut --use-gl --ldflags)
Edward Vigmond's avatar
Edward Vigmond committed
6
COMMON_INC    := -I. -DOBJ_CLASS -D_REENTRANT
7

8 9
FLTK_SOURCES  := $(wildcard *.fl)
OBJS = $(FLTK_SOURCES:.fl=.o)\
Edward Vigmond's avatar
Edward Vigmond committed
10 11 12 13
	$(patsubst %.cc,%.o,$(wildcard *.cc))\
	$(patsubst %.c,%.o,$(wildcard *.c))\
	$(patsubst %.C,%.o,$(wildcard *.C))

14
HDF5API_ROOT  := ./hdf5api
15
ifdef HDF5
Edward Vigmond's avatar
Edward Vigmond committed
16
LIB_CH5       := $(HDF5API_ROOT)/lib/libch5.a
Edward Vigmond's avatar
Edward Vigmond committed
17 18
LIB_HDF5      := -L$(HDF5API_ROOT)/lib -L$(HDF5_ROOT)/lib -lch5 -lhdf5_hl -lhdf5
COMMON_INC    += -DUSE_HDF5 -I$(HDF5_ROOT)/include -I$(HDF5API_ROOT)/include 
19 20
else
LIB_CH5       := 
21
LIB_HDF5      :=
Edward Vigmond's avatar
Edward Vigmond committed
22
OBJS          := $(OBJS:HDF5DataBrowser.o=)
23
endif
Edward Vigmond's avatar
Edward Vigmond committed
24

Edward Vigmond's avatar
Edward Vigmond committed
25
# MAC vs Linux differences
Edward Vigmond's avatar
Edward Vigmond committed
26 27
ifeq ($(HOSTMACHINE), Darwin)
  GLUT_LIB = -framework GLUT 
Edward Vigmond's avatar
Edward Vigmond committed
28
  FLTK_INC += /usr/X11/include
Edward Vigmond's avatar
Edward Vigmond committed
29 30
else
  GLUT_LIB = -lglut
31 32
  OMP_FLAG := -fopenmp
  LDFLAGS += $(OMP_FLAG)
Edward Vigmond's avatar
Edward Vigmond committed
33 34 35
ifeq (,$(findstring -lGL,$(FLTK_LD_FLAGS)))
  FLTK_LD_FLAGS += -lGL -lGLU
endif
Edward Vigmond's avatar
Edward Vigmond committed
36 37
endif

Edward Vigmond's avatar
Edward Vigmond committed
38
COMMON_LIBS  = -lpng -lpthread -lm -lz $(LIB_HDF5) 
Edward Vigmond's avatar
Edward Vigmond committed
39 40
LIBS         =  $(FLTK_LD_FLAGS) $(COMMON_LIBS) 
CPPFLAGS     =  $(FLTK_INC) $(COMMON_INC)
Edward Vigmond's avatar
Edward Vigmond committed
41 42
CXXFLAGS     = -std=c++11 -g -O$(DEBUG_LEVEL) $(OMP_FLAG) -MMD -DNOMINMAX  

Edward Vigmond's avatar
Edward Vigmond committed
43
# VTK
Edward Vigmond's avatar
Edward Vigmond committed
44
#VTK=1
Edward Vigmond's avatar
Edward Vigmond committed
45
ifdef VTK
46 47 48 49 50 51
VTK_LIBDIR     =/usr/lib64
VTK_INCDIR     =/usr/include/vtk-8.1
COMMON_INC    += -DUSE_VTK -I$(VTK_INCDIR)
VTK_LSLIBS     = $(shell ls $(VTK_LIBDIR)/libvtk*.so|grep -v Python|grep -v Java |grep -v TCL)
a              = $(subst $(VTK_LIBDIR)/lib,-l,$(VTK_LSLIBS) )
VTK_LIBS       = $(subst .so,,$(a) )
Edward Vigmond's avatar
Edward Vigmond committed
52 53 54
LIBS          += $(VTK_LIBS)
endif

Edward Vigmond's avatar
Edward Vigmond committed
55 56 57
ifdef ENABLE_LOGGING
CPPFLAGS += -DLOGGING_ENABLED
endif
Edward Vigmond's avatar
Edward Vigmond committed
58

59
#the files in OS_files contain OSMESA dependent clauses
60
OS_files= main.o Frame.o
61 62
OS_OBJS=$(filter-out $(OS_files),$(OBJS)) $(OS_files:.o=_os.o)

63
all: meshalyzer
Edward Vigmond's avatar
Edward Vigmond committed
64

Edward Vigmond's avatar
Edward Vigmond committed
65
meshalyzer: $(LIB_CH5) $(FLTK_SOURCES:.fl=.cc) $(OBJS) 
66
	$(CXX) $(LDFLAGS) -o meshalyzer $(sort $(OBJS)) $(GLUT_LIB) $(LIBS)
Edward Vigmond's avatar
Edward Vigmond committed
67
	fltk-config --post meshalyzer
Edward Vigmond's avatar
Edward Vigmond committed
68

Edward Vigmond's avatar
Edward Vigmond committed
69
mesalyzer: $(LIB_CH5) $(FLTK_SOURCES:.fl=.cc) $(OS_OBJS)
70
	$(CXX) $(LDFLAGS) -o mesalyzer $(sort $(OS_OBJS)) -lOSMesa $(LIBS) -lrt
71 72
	fltk-config --post mesalyzer

73
ifdef HDF5
Edward Vigmond's avatar
Edward Vigmond committed
74
$(LIB_CH5): 
75
	cd hdf5api && make all 
Edward Vigmond's avatar
Edward Vigmond committed
76
	cd hdf5api && make install PREFIX=. 
77
endif
Edward Vigmond's avatar
Edward Vigmond committed
78

79
$(OS_files:.o=_os.o): %_os.o: %.cc
Edward Vigmond's avatar
Edward Vigmond committed
80
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -D OSMESA -c -o $@  $<
81

Edward Vigmond's avatar
Edward Vigmond committed
82
clean:
83
	rm -rf $(FLTK_SOURCES:.fl=.h) $(FLTK_SOURCES:.fl=.cc) *.o *.d meshalyzer mesalyzer meshalyzer.app
Edward Vigmond's avatar
Edward Vigmond committed
84 85 86
ifdef HDF5
	cd hdf5api && make clean
endif
Edward Vigmond's avatar
Edward Vigmond committed
87 88 89

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

Edward Vigmond's avatar
Edward Vigmond committed
91 92
docs: 
	doxygen Doxyfile
93
ifdef HDF5
Edward Vigmond's avatar
Edward Vigmond committed
94
	cd hdf5api && doxygen Doxyfile
95
endif
96

97
%.h %.cc: %.fl
98
	fluid -c -o .cc $<
99 100

-include $(OBJS:.o=.d)
Edward Vigmond's avatar
Edward Vigmond committed
101 102 103

.PHONY: utils