Makefile 2.18 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++
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 35
COMMON_LIBS  = $(FLTK_LIBS) -lpng -lpthread -lm -lz $(LIB_HDF5)
#LDFLAGS      = -fopenmp
Edward Vigmond's avatar
Edward Vigmond committed
36
CXXFLAGS     = -std=c++11 -I$(HDF5_ROOT)/include -I$(HDF5API_ROOT)/include $(FLTK_INC) $(COMMON_INC)
37
HDF5_CXXFLAGS=£(CXXFLAGS)
38
LIBS         = -L$(HDF5API_ROOT)/lib $(FLTK_LD_FLAGS) $(COMMON_LIBS) 
Edward Vigmond's avatar
Edward Vigmond committed
39

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

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

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

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

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

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

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

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

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

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

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

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

.PHONY: utils