Makefile 1.99 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

Edward Vigmond's avatar
Edward Vigmond committed
19
20
21
22
23
24
ifeq ($(HOSTMACHINE), Darwin)
  GLUT_LIB = -framework GLUT 
else
  GLUT_LIB = -lglut
endif

25
COMMON_LIBS  = $(FLTK_LIBS) -lpng -lpthread -lm -lz $(LIB_HDF5) 
Edward Vigmond's avatar
Edward Vigmond committed
26

Edward Vigmond's avatar
Edward Vigmond committed
27
LIBS     =  -L$(HDF5API_ROOT)/lib   $(FLTK_LD_FLAGS) $(COMMON_LIBS)
28
#LDFLAGS  =  -fopenmp
29
CXXFLAGS =  -std=c++11 -I$(HDF5API_ROOT)/src $(FLTK_INC) $(COMMON_INC)
Edward Vigmond's avatar
Edward Vigmond committed
30

Edward Vigmond's avatar
Edward Vigmond committed
31
32
33
34
CPPFLAGS = $(CFLAGS) -g
ifdef ENABLE_LOGGING
CPPFLAGS += -DLOGGING_ENABLED
endif
Edward Vigmond's avatar
Edward Vigmond committed
35

36
37
38
39
40
FLTK_SOURCES = $(wildcard *.fl)
OBJS = $(FLTK_SOURCES:.fl=.o)\
	$(patsubst %.cc,%.o,$(wildcard *.cc))\
	$(patsubst %.c,%.o,$(wildcard *.c))\
	$(patsubst %.C,%.o,$(wildcard *.C))
41

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

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

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

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

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

60
endif
Edward Vigmond's avatar
Edward Vigmond committed
61

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

Edward Vigmond's avatar
Edward Vigmond committed
65
clean:
66
	rm -rf $(FLTK_SOURCES:.fl=.h) $(FLTK_SOURCES:.fl=.cc) *.o *.d meshalyzer mesalyzer meshalyzer.app
Edward Vigmond's avatar
Edward Vigmond committed
67
68
69

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

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

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

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

.PHONY: utils