Makefile 2.08 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 10
FLTK_SOURCES  := $(wildcard *.fl)
OBJS = $(FLTK_SOURCES:.fl=.o)\
Edward Vigmond's avatar
Edward Vigmond committed
11 12 13 14
	$(patsubst %.cc,%.o,$(wildcard *.cc))\
	$(patsubst %.c,%.o,$(wildcard *.c))\
	$(patsubst %.C,%.o,$(wildcard *.C))

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

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

33 34 35 36
COMMON_LIBS  = $(FLTK_LIBS) -lpng -lpthread -lm -lz $(LIB_HDF5)
#LDFLAGS      = -fopenmp
CXXFLAGS     = -std=c++11 -I$(HDF5API_ROOT)/src $(FLTK_INC) $(COMMON_INC)
LIBS         = -L$(HDF5API_ROOT)/lib $(FLTK_LD_FLAGS) $(COMMON_LIBS) 
Edward Vigmond's avatar
Edward Vigmond committed
37

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

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

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

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

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

57
ifdef HDF5
Edward Vigmond's avatar
Edward Vigmond committed
58
$(LIB_CH5): 
59 60
	cd hdf5api && make all $(LIB_CH5) $(FLTK_SOURCES:.fl=.cc) $(OBJS) $(LIB_CH5)

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

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

Edward Vigmond's avatar
Edward Vigmond committed
72 73
docs: 
	doxygen Doxyfile
74
ifdef HDF5
Edward Vigmond's avatar
Edward Vigmond committed
75
	cd hdf5api && doxygen Doxyfile
76
endif
77

78 79 80 81
%.h %.cc: %.fl
	fluid -c $<

-include $(OBJS:.o=.d)
Edward Vigmond's avatar
Edward Vigmond committed
82 83 84

.PHONY: utils