Makefile 2.15 KB
Newer Older
Edward Vigmond's avatar
Edward Vigmond committed
1
HOSTMACHINE := $(shell uname)
2
#HDF5=1
Edward Vigmond's avatar
Edward Vigmond committed
3
include make.conf
4
CXX:=c++ -std=c++11 -fopenmp
Edward Vigmond's avatar
Edward Vigmond committed
5

Edward Vigmond's avatar
Edward Vigmond committed
6
HDF5API_ROOT  := ./hdf5api
7

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

12 13
FLTK_SOURCES  := $(wildcard *.fl)
OBJS = $(FLTK_SOURCES:.fl=.o)\
Edward Vigmond's avatar
Edward Vigmond committed
14 15 16 17
	$(patsubst %.cc,%.o,$(wildcard *.cc))\
	$(patsubst %.c,%.o,$(wildcard *.c))\
	$(patsubst %.C,%.o,$(wildcard *.C))

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

Edward Vigmond's avatar
Edward Vigmond committed
28 29 30 31 32 33
ifeq ($(HOSTMACHINE), Darwin)
  GLUT_LIB = -framework GLUT 
else
  GLUT_LIB = -lglut
endif

34
COMMON_LIBS  = $(FLTK_LIBS) -lpng -lpthread -lm -lz $(LIB_HDF5) -lGL -lGLU
35
CXXFLAGS     = -std=c++11 $(OMP_FLAG) -I$(HDF5_ROOT)/include -I$(HDF5API_ROOT)/include $(FLTK_INC) $(COMMON_INC)
36
HDF5_CXXFLAGS=£(CXXFLAGS)
37
LIBS         = -L$(HDF5API_ROOT)/lib $(FLTK_LD_FLAGS) $(COMMON_LIBS) 
Edward Vigmond's avatar
Edward Vigmond committed
38

Edward Vigmond's avatar
Edward Vigmond committed
39 40 41 42
CPPFLAGS = $(CFLAGS) -g
ifdef ENABLE_LOGGING
CPPFLAGS += -DLOGGING_ENABLED
endif
Edward Vigmond's avatar
Edward Vigmond committed
43

44
#the files in OS_files contain OSMESA dependent clauses
45
OS_files= main.o Frame.o
46 47
OS_OBJS=$(filter-out $(OS_files),$(OBJS)) $(OS_files:.o=_os.o)

48
all: meshalyzer
Edward Vigmond's avatar
Edward Vigmond committed
49 50

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

54
mesalyzer: $(LIB_CH5) $(FLTK_SOURCES:.fl=.cc) $(OS_OBJS) $(LIB_CH5)
55
	$(CXX) $(LDFLAGS) -o mesalyzer $(sort $(OS_OBJS)) -lOSMesa $(LIBS) -lrt
56 57
	fltk-config --post mesalyzer

58
ifdef HDF5
Edward Vigmond's avatar
Edward Vigmond committed
59
$(LIB_CH5): 
60
	cd hdf5api && make all 
61
endif
Edward Vigmond's avatar
Edward Vigmond committed
62

63 64 65
$(OS_files:.o=_os.o): %_os.o: %.cc
	$(CXX) $(CXXFLAGS) $(CPP_FLAGS) -D OSMESA -c -o $@  $<

Edward Vigmond's avatar
Edward Vigmond committed
66
clean:
67
	rm -rf $(FLTK_SOURCES:.fl=.h) $(FLTK_SOURCES:.fl=.cc) *.o *.d meshalyzer mesalyzer meshalyzer.app
Edward Vigmond's avatar
Edward Vigmond committed
68 69 70
ifdef HDF5
	cd hdf5api && make clean
endif
Edward Vigmond's avatar
Edward Vigmond committed
71 72 73

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

Edward Vigmond's avatar
Edward Vigmond committed
75 76
docs: 
	doxygen Doxyfile
77
ifdef HDF5
Edward Vigmond's avatar
Edward Vigmond committed
78
	cd hdf5api && doxygen Doxyfile
79
endif
80

81
%.h %.cc: %.fl
82
	fluid -c -o .cc $<
83 84

-include $(OBJS:.o=.d)
Edward Vigmond's avatar
Edward Vigmond committed
85 86 87

.PHONY: utils