]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/build/config.mk
Fixes in order to avoid compilation problems.
[u/mrichter/AliRoot.git] / HLT / MUON / build / config.mk
1 ################################################################################
2 #
3 # Author: Artur Szostak
4 # Email:  artur@alice.phy.uct.ac.za | artursz@iafrica.com
5 #
6 ################################################################################
7
8 # Set the platform variable if not yet set.
9 ifndef PLATFORM
10 PLATFORM = $(shell uname)
11 endif
12
13 # Get verison numbers.
14 MAJOR_VERSION = $(shell cat $(SRC_DIR)/Version/major.number)
15 MINOR_VERSION = $(shell cat $(SRC_DIR)/Version/minor.number)
16
17
18 .SUFFIXES: .cxx .hpp .h .o .d
19
20 # Set the module name, i.e. the name of the executable / library.
21 ifdef BINARY
22 MODULE_NAME = $(BINARY)
23 endif
24
25 ifdef LIBRARY
26 MODULE_NAME = $(LIBRARY)
27 endif
28
29 ################################################################################
30 # Directory layout:
31
32 TOP_DIR        = $(shell pwd)
33 BIN_DIR        = $(TOP_DIR)/bin
34 LIB_DIR        = $(TOP_DIR)/lib
35 INCLUDE_DIR    = $(TOP_DIR)/include
36 OUTPUT_DIR     = $(TOP_DIR)/output
37 BUILD_DIR      = $(TOP_DIR)/build
38 MACRO_DIR      = $(TOP_DIR)/macros
39 SRC_DIR        = $(TOP_DIR)/src
40
41 # The base target directories.
42 BIN_TARGET_DIR    = $(BIN_DIR)/$(PLATFORM)
43 LIB_TARGET_DIR    = $(LIB_DIR)/$(PLATFORM)
44 OUTPUT_TARGET_DIR = $(OUTPUT_DIR)/$(MODULE_NAME)/$(PLATFORM)
45
46 # The list of source code sub directory names.
47 SRC_SUBDIR_NAMES = AliRoot Buffers Clustering Control Decision PubSub PipeIO \
48         Tracking Version System System/Linux System/Win32 Debug Framework DDL \
49         BCMP
50
51 # Create full source and target directory names.
52 SRC_SUBDIRS    = $(addprefix $(SRC_DIR)/,$(SRC_SUBDIR_NAMES))
53 OUTPUT_TARGET_SUBDIRS = $(addprefix $(OUTPUT_TARGET_DIR)/,$(SRC_SUBDIR_NAMES))
54
55 # Setup the distribution file name and directory structure.
56 DISTRIBUTION_DIRNAME = dHLT_v$(MAJOR_VERSION)-$(MINOR_VERSION)
57 DISTRIBUTION_DIR = $(OUTPUT_DIR)/distrib/$(PLATFORM)
58 DISTRIBUTION_SUBDIR = $(DISTRIBUTION_DIR)/$(DISTRIBUTION_DIRNAME)
59
60 ################################################################################
61
62 # Set the target name, symbolic link and full distribution directory paths.
63 ifdef BINARY
64 TARGET_NAME = $(BIN_TARGET_DIR)/$(BINARY)$(BIN_EXT)
65 SYMLINK_NAME = $(BIN_DIR)/$(BINARY)$(BIN_EXT)
66 DISTRIBUTION_TARGET_DIR = $(DISTRIBUTION_SUBDIR)/bin
67 endif
68
69 ifdef LIBRARY
70 TARGET_NAME = $(LIB_TARGET_DIR)/$(LIB_PREFIX)$(LIBRARY)$(LIB_EXT)
71 SYMLINK_NAME = $(LIB_DIR)/$(LIB_PREFIX)$(LIBRARY)$(LIB_EXT)
72 DISTRIBUTION_TARGET_DIR = $(DISTRIBUTION_SUBDIR)/lib
73 endif
74
75 ################################################################################
76
77 include $(BUILD_DIR)/$(PLATFORM).platform.mk
78
79 ################################################################################
80
81 # If we want a verbose build then all the actuall commands that are executed
82 # are printed to screen.
83 ifdef VERBOSE_MAKE
84 VERBOSE =
85 else
86 VERBOSE = @
87 endif
88
89 ################################################################################
90 # Setup the CXXFLAGS compiler flags and LINKFLAGS for the linker.
91
92 ifdef BINARY
93 CXXFLAGS = $(INCLUDES) $(MACROS) $(BINARY_CXXFLAGS)
94 LINKFLAGS = $(BINARY_CXXFLAGS) $(LIBRARY_PATHS) $(LIBRARIES)
95 endif
96
97 ifdef LIBRARY
98 CXXFLAGS = $(INCLUDES) $(MACROS) $(LIBRARY_CXXFLAGS)
99 LINKFLAGS = $(LIBRARY_CXXFLAGS) $(LIBRARY_PATHS) $(LIBRARIES)
100 endif
101
102 ifdef DEBUGGING
103 MACROS += DEBUG
104 CXXFLAGS += $(CXX_DEBUG)
105 LINKFLAGS += $(CXX_DEBUG)
106 BIN_TARGET_DIR := $(BIN_TARGET_DIR)-debug
107 LIB_TARGET_DIR := $(LIB_TARGET_DIR)-debug
108 OUTPUT_TARGET_DIR := $(OUTPUT_TARGET_DIR)-debug
109 DISTRIBUTION_FILE = dHLT_$(PLATFORM)-debug_v$(MAJOR_VERSION)-$(MINOR_VERSION).tar.gz
110 else
111 CXXFLAGS += $(OPTIMIZATION)
112 LINKFLAGS += $(OPTIMIZATION)
113 DISTRIBUTION_FILE = dHLT_$(PLATFORM)_v$(MAJOR_VERSION)-$(MINOR_VERSION).tar.gz
114 endif
115
116 ################################################################################
117
118 # Create a list of headers from the source file list.
119 HEADERS := $(SOURCES:.cxx=.hpp)
120
121 ifndef DICTIONARY_HEADERS
122 DICTIONARY_HEADERS = $(HEADERS)
123 endif
124
125 # Add the dictionary file without adding its header to the HEADERS list.
126 ifdef DICTIONARY
127 SOURCES += $(DICTIONARY)
128 endif
129
130 # Create a list of object .o and dependancy .d files from the list of source files.
131 OBJECTS = $(addprefix $(OUTPUT_TARGET_DIR)/,$(SOURCES:.cxx=.o))
132 DEPENDS = $(addprefix $(OUTPUT_TARGET_DIR)/,$(SOURCES:.cxx=.d))
133
134 # Make the includes search paths from the source directory and the output
135 # target directory.
136 INCLUDES += $(SRC_DIR) $(OUTPUT_TARGET_DIR)
137
138 # The library path should also contain the lib sub directory.
139 LIBRARY_PATHS += $(LIB_TARGET_DIR)
140
141 # Add compiler specific flag prefices:
142 INCLUDES := $(addprefix $(INCLUDE_PREFIX),$(INCLUDES))
143 MACROS := $(addprefix $(MACRO_PREFIX),$(MACROS))
144 LIBRARIES := $(addprefix $(LIBRARY_PREFIX),$(LIBRARIES))
145 LIBRARY_PATHS := $(addprefix $(LIBPATH_PREFIX),$(LIBRARY_PATHS))
146
147 ################################################################################
148 # Tell make where to find source files.
149 # Note: this must come after the OUTPUT_TARGET_DIR is appended with -debug
150 vpath %.cxx $(SRC_DIR) $(SRC_SUBDIRS) $(OUTPUT_TARGET_DIR) $(OUTPUT_TARGET_SUBDIRS)
151 vpath %.hpp $(SRC_DIR) $(SRC_SUBDIRS) $(OUTPUT_TARGET_DIR) $(OUTPUT_TARGET_SUBDIRS)
152 vpath %.h $(SRC_DIR) $(SRC_SUBDIRS) $(OUTPUT_TARGET_DIR) $(OUTPUT_TARGET_SUBDIRS)
153 vpath %.number $(SRC_DIR)/Version $(OUTPUT_TARGET_DIR)