-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
64 lines (46 loc) · 1.64 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# This build a library which is named libMGDO{name_dir}.so
include buildTools/config.mk
packageName := $(notdir $(shell pwd))
SHLIB := lib$(packageName).$(SOSUFFIX)
ROOTDICTCCNAME := BeGe$(packageName)DICT.C
ROOTDICTHHNAME := BeGe$(packageName)DICT.h
ROOTDICTOBJECT := $(ROOTDICTCCNAME:.C=.o)
INCLUDEFLAGS += $(ROOT_INCLUDE_FLAGS)
LIBFLAGS += $(ROOT_LIB_FLAGS)
SOURCES ?= $(wildcard *.cc)
OBJECTS ?= $(SOURCES:.cc=.o)
ROOTDICTHEADERS ?= $(shell grep -l ClassDef $(wildcard *.hh) | xargs)
.PHONY: all depend lib clean shared
all: lib finish
lib: shared
shared:: $(SHLIB)
.depend depend: $(ROOTDICTCCNAME)
@echo Checking dependencies...
$(CXX) -M $(CXXFLAGS) $(INCLUDEFLAGS) $(SOURCES) $(ROOTDICTCCNAME) > .depend
%.o: %.cc
$(CXX) -c $(CXXFLAGS) $(INCLUDEFLAGS) $<
%.o: %.C
$(CXX) -c $(CXXFLAGS) $(INCLUDEFLAGS) $<
$(ROOTDICTCCNAME): $(ROOTDICTHEADERS) LinkDef.h
@echo Rootifying files...
@rm -f $(ROOTDICTCCNAME) $(ROOTDICTHHNAME)
$(ROOTCINT) $(ROOTDICTCCNAME) -c -p $(CXXFLAGS) $(ROOTDICTINCLUDE) $(INCLUDEFLAGS) $(ROOTDICTHEADERS) LinkDef.h
$(SHLIB): $(OBJECTS) $(ROOTDICTOBJECT)
$(SOMAKER) $(SOFLAGS) -o $(SHLIB) $(OBJECTS) $(ROOTDICTOBJECT) $(LIBFLAGS)
clean::
@rm -f $(SHLIB) $(ROOTDICTCCNAME) $(ROOTDICTHHNAME) *.o *~ .depend
ifneq ($(MAKECMDGOALS),clean)
-include .depend
endif
ifneq ($(SOSUFFIX),so)
shared::
@if [ ! -f $(basename $(SHLIB)).so ]; then ln -s $(SHLIB) $(basename $(SHLIB)).so; fi
endif
clean::
@rm -f $(basename $(SHLIB)).*
finish:
@echo
@echo "BeGe classes built, be sure to add the following line to your ~/.rootlogon.C file:"
@echo
@echo " gApplication->ExecuteFile(\"$(shell pwd)/LoadMGMClasses.C\");"
@echo