override ALICE_ROOT=$(shell pwd)
include build/Makefile.config
+##################################################################
+#
+# Where to install libraries and binaries
+# and common header files
-# Where to install libraries and binaries
LIBPATH=lib/tgt_$(ALICE_TARGET)
BINPATH=bin/tgt_$(ALICE_TARGET)
+EXPORTDIR = $(ALICE_ROOT)/include
+##################################################################
-##### include machine dependent macros #####
+##################################################################
+# include machine dependent macros
-#include $(filter-out DEBUG,build/Makefile.$(ALICE_TARGET))
-include build/Makefile.$(ALICE_TARGET)
+-include build/Makefile.$(ALICE_TARGET)
+##################################################################
+
+##################################################################
+#
+# Check if called with debug
-# Check if called with debug
ifeq ($(ALIDEBUG),YES)
override ALICE_TARGET:=$(ALICE_TARGET)DEBUG
FFLAGS := -g $(filter-out -O%,$(FFLAGS))
CXXFLAGS := -g $(filter-out -O%,$(CXXLAGS))
CFLAGS := -g $(filter-out -O%,$(CLAGS))
endif
+##################################################################
+
+##################################################################
+#
+# Modules to build
+# COMMENTED OUT FOR TEST PURPOSES
-##### Modules to build #####
+ALIROOTMODULES:= STEER \
+ TGeant3 PHOS TRD TPC ZDC MUON PMD FMD TOF ITS \
+ CASTOR RICH START STRUCT EVGEN RALICE ALIFAST \
+ THijing CONTAINERS MEVSIM TMEVSIM THbtp HBTP EMCAL
-#needs to add: VZERO TGeant4 AliGeant4 GEODB Euclid
-#
+#ALIROOTMODULES:= HBTP
-MODULES:=STEER TPC PMD CONTAINERS ZDC STRUCT RALICE EMCAL \
- ALIFAST CASTOR FMD START TGeant3 EVGEN THijing TMEVSIM \
- MEVSIM PDF PYTHIA PYTHIA6 TRD GEANT321 MINICERN TOF \
- ITS RICH PHOS MUON HIJING LHC HBTP THbtp
+CERNMODULES:= PDF PYTHIA PYTHIA6 GEANT321 MINICERN HIJING
+
+
+MODULES:=$(ALIROOTMODULES) $(CERNMODULES)
+
+##################################################################
MODULES += ALIROOT
MODDIRS := MODULES
-
-# look for include files in each of the moduled
+
+#############################################################
+#
+# Default include dirs for
+# C++, Fortran, Cint, and dependencies
+# The module directory will be added by each module
+#
+
CXXFLAGS += $(patsubst %,-I%,$(ALICE_ROOT))
-CXXFLAGS += $(patsubst %,-I$(ALICE_ROOT)/%,$(MODULES))
+CXXFLAGS += -I$(ALICE_ROOT)/include
CXXFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include)
FFLAGS += $(patsubst %,-I%,$(ALICE_ROOT))
-FFLAGS += $(patsubst %,-I$(ALICE_ROOT)/%,$(MODULES))
+FFLAGS += -I$(ALICE_ROOT)/include
FFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include)
CINTFLAGS += $(patsubst %,-I%,$(ALICE_ROOT))
-CINTFLAGS += $(patsubst %,-I$(ALICE_ROOT)/%,$(MODULES))
+CINTFLAGS += -I$(ALICE_ROOT)/include
CINTFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include)
DEPINC += $(patsubst %,-I%,$(ALICE_ROOT))
-DEPINC += $(patsubst %,-I$(ALICE_ROOT)/%,$(MODULES))
+DEPINC += -I$(ALICE_ROOT)/include
DEPINC += $(patsubst %,-I%,$(ROOTSYS)/include)
+#############################################################
+#############################################################
+#
+# Libraries to link binaries against
+# Libraries will be linked againstSHLIB
LIBS := $(ROOTLIBS) $(SYSLIBS) $(GLIBS)
+#############################################################
# default target
default: alilibs aliroot
-# each module must add to this
+
+#############################################################
+#
+# Each module will add to this
+
ALLLIBS :=
ALLEXECS :=
INCLUDEFILES :=
BINLIBS :=
-
+EXPORTFILES :=
+#############################################################
BINLIBDIRS := -L$(ALICE_ROOT)/$(LIBPATH)
-.PHONY: alilibs aliroot makedistr
+
#Dependencies of module.mk files
include build/module.dep
-# Check if module.mk is present for the library
+#############################################################
+#
+# Check if module.mk is present for the library
%.mk:
@echo "***** Creating $@ file *****";
- share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@;
+ @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@;
+#############################################################
-# If cleaning, do not include dependencies or module.mk files.
-ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
+# **************************************************************************
+#
+# If cleaning, do not include
+# dependencies or module.mk files.
+
+ifeq ($(findstring $(MAKECMDGOALS), clean clean-all clean-dicts clean-modules clean-depend clean-objects clean-libs clean-bins),)
+#ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
+
+# If makeing modules, not not include
+# anything
-# description of each module
-include $(patsubst %,%/module.mk,$(MODULES))
+ifneq ($(findstring modules,$(MAKECMDGOALS)),modules)
-# include dependencies if not making them!
-ifneq ($(MAKECMDGOALS),depend)
+#############################################################
+#
+# Include the modules
+-include $(patsubst %,%/module.mk,$(MODULES))
+#############################################################
+
+#############################################################
+#
+# include dependencies if not making them!
+ifneq ($(MAKECMDGOALS),depend )
+# Don't include if cleaning of any sort
+ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
include $(INCLUDEFILES)
endif
+endif
+#############################################################
endif
+endif
+# **************************************************************************
+
+#############################################################
+#
+# include dummy dependency file
+# *MUST* be last includefile
+include build/dummy.d
+#############################################################
+
# targets
-aliroot: $(BINPATH) $(ALLEXECS) bin
+.PHONY: alilibs aliroot makedistr clean
+modules: $(patsubst %,%/module.mk,$(MODULES))
-alilibs: $(LIBPATH) $(ALLLIBS) lib
+aliroot: $(BINPATH) $(ALLEXECS) alilibs bin
+
+#haders: $(EXPORTFILES)
+
+alilibs: $(LIBPATH) $(ALLLIBS) lib modules
# Single Makefile "distribution": Makefile + modules + mkdepend scripts
makedistr: $(MODULES)
all: aliroot
-depend: $(INCLUDEFILES)
+depend: $(INCLUDEFILES)
debug:
@echo "***** Entering DEBUG mode. *****"
@echo "***** Making $@ *****"
mkdir -p $@
-
-cleanall:
+build/dummy.d: $(EXPORTFILES)
+ @(if [ ! -f $@ ] ; then \
+ touch $@; \
+ fi)
+
+clean:
+ @echo "***** No targen clean, use on of these *****"
+ @echo " clean-aliroot : Clean up all aliroot libraries"
+ @echo " clean-MODULENAME : Clean everything from module MODULENAME"
+ @echo " clean-all : Cleans up everything, including cern libraires"
+ @echo " clean-modules : Clean all module.mk file in all modules"
+ @echo " clean-libs : Clean all libraries (not object files)"
+ @echo "********************************************"
+
+clean-all: clean-modules
@echo "***** Cleaning up everything ****"
rm -rf $(patsubst %,%/module.mk,$(MODULES))
rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES))
rm -rf lib/tgt_$(ALICE_TARGET)
rm -rf bin/tgt_$(ALICE_TARGET)
+ rm -rf $(EXPORTDIR)
+
+#This cleans only libraries that are not CERN-libraries
-clean: clean-modules clean-depend clean-objects clean-libs clean-bins
+clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES))
+clean-dicts:
+ @echo "***** Cleaning up G__ files *****"
+ rm -rf */tgt_$(ALICE_TARGET)/G__*
clean-modules:
@echo "***** Cleaning up module.mk files *****"
rm -rf $(patsubst %,%/module.mk,$(MODULES))