-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmake.include
More file actions
117 lines (103 loc) · 3.72 KB
/
make.include
File metadata and controls
117 lines (103 loc) · 3.72 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#
# make.include for dk2nu
#
bindir=$(DK2NU)/bin
libdir=$(DK2NU)/lib
tmpdir=$(DK2NU)/tmp
includedir=$(DK2NU)/include
LIBNAME = lib$(PACKAGE)
SHAREDLIB := $(libdir)/$(LIBNAME).so
DICTIONARY = _ROOT_DICT_$(PACKAGE)
sources := $(filter-out $(DICTIONARY).cc, $(wildcard *.cxx) $(wildcard *.cc))
allheaders := $(filter-out $(DICTIONARY).h, $(wildcard *.h) $(wildcard *.hh))
headers := $(filter-out LinkDef.h $(DICTIONARY).h, $(allheaders))
objects := $(addsuffix .o, $(basename $(sources) $(DICTIONARY) ))
depfiles := $(addsuffix .d, $(basename $(sources) $(DICTIONARY) ))
ARCHNAME = $(shell uname -s)
#
# set compile/link flags
#
DEBUG = -g
CXX = g++
CXXFLAGS += -O2 $(DEBUG) -fPIC -Wall -pedantic-errors -W -Wno-long-long
CXXFLAGS += -Wwrite-strings -Wno-inline -Woverloaded-virtual -Wno-inline
LDFLAGS += $(DEBUG) -L$(ROOTSYS)/lib -L$(libdir)
INCLUDE += -I$(DK2NU) -I$(includedir) -I$(ROOTSYS)/include
ifneq ($(ARCHNAME),Darwin)
SLIBFLAGS := -shared
else
SLIBFLAGS := -dynamiclib -single_module -flat_namespace \
-undefined dynamic_lookup
endif
# GENIE interface require additional locations
ifneq ($(GENIE),)
LDFLAGS += -L$(GENIE)/lib
INCLUDE += -I$(GENIE)/src
# this won't work when GENIE wasn't built in-place
GOPT_LIBXML2_LIB=$(shell grep LIBXML2_LIB $(GENIE)/src/make/Make.config | cut -d'=' -f2)
GOPT_LOG4CPP_LIB=$(shell grep LOG4CPP_LIB $(GENIE)/src/make/Make.config | cut -d'=' -f2)
GOPT_LIBXML2_INC=$(shell grep LIBXML2_INC $(GENIE)/src/make/Make.config | cut -d'=' -f2)
GOPT_LOG4CPP_INC=$(shell grep LOG4CPP_INC $(GENIE)/src/make/Make.config | cut -d'=' -f2)
LDFLAGS += -L$(GOPT_LIBXML2_LIB) -L$(GOPT_LOG4CPP_LIB)
INCLUDE += -I$(GOPT_LIBXML2_INC) -I$(GOPT_LOG4CPP_INC)
# try other ways too ... (semi-)standard UPS packaging paths
ifneq ($(LIBXML2_FQ_DIR),)
LDFLAGS += -L$(LIBXML2_FQ_DIR)/lib
INCLUDE += -I$(LIBXML2_FQ_DIR)/include/libxml2
endif
ifneq ($(LOG4CPP_FQ_DIR),)
LDFLAGS += -L$(LOG4CPP_FQ_DIR)/lib
INCLUDE += -I$(LOG4CPP_FQ_DIR)/include -I$(LOG4CPP_FQ_DIR)/include/log4cpp
endif
endif
#
# make sure architecture is consistent in case of old 32-bit builds
#
# ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped
# ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), not stripped
# Mach-O dynamically linked shared library i386
#
RCOREARCH = $(shell file $(ROOTSYS)/lib/libCore.so | cut -d':' -f2)
IS32 += $(findstring 32-bit,$(RCOREARCH))
IS32 += $(findstring i386,$(RCOREARCH))
ifneq ($(strip $(IS32)),)
CXXFLAGS += -m32
LDFLAGS += -m32
else
CXXFLAGS += -m64
LDFLAGS += -m64
endif
$(DICTIONARY).cc: $(headers) LinkDef.h
@rm -f $(DICTIONARY).*
rootcint -f $(DICTIONARY).cc -c $(INCLUDE) $(headers) LinkDef.h
$(SHAREDLIB): $(depfiles) $(objects)
@echo "<**building library**> $(@)"
@echo "$(SHAREDLIB) depends on $(objects)"
$(CXX) $(LDFLAGS) $(SLIBFLAGS) -o $@ $(objects) $(LIBDEPS)
##$(tmpdir)/
%.o: %.cxx
## @if [ ! -d "$(tmpdir)" ]; then /bin/mkdir "$(tmpdir)"; fi
@echo "<**compiling**> $(<)"
@$(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@
##$(tmpdir)/
%.o: %.cc
## @if [ ! -d "$(tmpdir)" ]; then /bin/mkdir "$(tmpdir)"; fi
@echo "<**compiling**> $(<)"
$(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@
##$(tmpdir)/
%.d: %.cxx
## @if [ ! -d "$(tmpdir)" ]; then /bin/mkdir "$(tmpdir)"; fi
@echo "<**depends**> $(<)"
@$(CXX) $(CXXFLAGS) $(INCLUDE) -M $< > $@
##$(tmpdir)/
%.d: %.cc
## @if [ ! -d "$(tmpdir)" ]; then /bin/mkdir "$(tmpdir)"; fi
@echo "<**depends**> $(<)"
@$(CXX) $(CXXFLAGS) $(INCLUDE) -M $< > $@
clean:
@echo "<**clean $(PACKAGE)**>"
@rm -f *.d *.o
# @if [ -d "$(tmpdir)" ]; then rm -r "$(tmpdir)"; fi
@if [ -f "$(DICTIONARY).cc" ]; then rm $(DICTIONARY).* ; fi
@if [ -f "$(SHAREDLIB)" ]; then rm $(SHAREDLIB); fi
# .PHONEY: