Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:11:33

0001 ##
0002 # CaloCDB
0003 #
0004 # @file
0005 # @version 0.1
0006 
0007 # Define your compiler and flags (adjust as needed)
0008 CXX = g++
0009 CXXFLAGS = -g -std=c++20 -Wall -Wextra -pedantic \
0010 -Wshadow -Wconversion -Wsign-conversion -Wnull-dereference \
0011 -Wformat=2 -Wduplicated-cond -Wuseless-cast -Wold-style-cast \
0012 -Wnoexcept -Woverloaded-virtual
0013 
0014 # ROOT and sPHENIX flags
0015 ROOT_CPPFLAGS = $(shell root-config --cflags | sed 's/-I/-isystem /g')
0016 ROOT_LIBFLAGS = `root-config --libs`
0017 sPHENIX_CPPFLAGS = -isystem $(OFFLINE_MAIN)/include -isystem $(OFFLINE_MAIN)/rootmacros 
0018 sPHENIX_LIBFLAGS = -L$(OFFLINE_MAIN)/lib -lcalo_io -lcdbobjects
0019 
0020 # Your project-specific flags
0021 CPPFLAGS = -I$(MYINSTALL)/include
0022 LIBFLAGS = -L$(MYINSTALL)/lib -lCaloTower 
0023 
0024 # Combine all C++ flags for compilation
0025 ALL_CPPFLAGS = $(ROOT_CPPFLAGS) $(sPHENIX_CPPFLAGS) $(CPPFLAGS)
0026 
0027 # Define your source files and output executables
0028 # Use a wildcard to automatically pick up all .C files in 'macros'
0029 SRCS = $(wildcard macros/*.C)
0030 
0031 # List all your executable targets explicitly
0032 ALL_TARGETS = bin/genStatus \
0033               bin/Fun4All_CaloCDB \
0034               bin/printStats
0035 
0036 # Define a stamp file for Cppcheck
0037 CPPCHECK_STAMP = .cppcheck_ran_stamp
0038 
0039 #--- Default target: builds all programs and runs Cppcheck ---
0040 # all: $(ALL_TARGETS) cppcheck
0041 all: $(ALL_TARGETS)
0042 
0043 #--- Rule for building individual executables (adjust as needed if they have unique dependencies) ---
0044 # This is a pattern rule that says: to build 'bin/X' from 'macros/X.C'
0045 bin/%: macros/%.C
0046         @echo "Building $@ from $<"
0047         mkdir -p bin
0048         $(CXX) $(CXXFLAGS) $(ALL_CPPFLAGS) -o $@ $< $(ROOT_LIBFLAGS) $(sPHENIX_LIBFLAGS) $(LIBFLAGS)
0049 
0050 # all: bin/genStatus bin/genFittingStatus bin/Fun4All_CaloCDB bin/printStats
0051 
0052 # bin/genStatus: macros/genStatus.C
0053 #       mkdir -p bin
0054 #       g++ -o $@ $< $(ROOT_CPPFLAGS) $(sPHENIX_CPPFLAGS) $(ROOT_LIBFLAGS) $(sPHENIX_LIBFLAGS) -lcdbobjects -lcalo_io
0055 
0056 # bin/printStats: macros/printStats.C
0057 #       mkdir -p bin
0058 #       g++ -o $@ $< $(ROOT_CPPFLAGS) $(sPHENIX_CPPFLAGS) $(ROOT_LIBFLAGS) $(sPHENIX_LIBFLAGS) -lcalo_io
0059 
0060 # bin/genFittingStatus: macros/genFittingStatus.C
0061 #       mkdir -p bin
0062 #       g++ -o $@ $< $(ROOT_CPPFLAGS) $(sPHENIX_CPPFLAGS) $(ROOT_LIBFLAGS) $(sPHENIX_LIBFLAGS) -lcdbobjects -lcalo_io
0063 
0064 bin/Fun4All_CaloCDB: macros/Fun4All_CaloCDB.C
0065         mkdir -p bin
0066         $(CXX) $(CXXFLAGS) $(ALL_CPPFLAGS) -o $@ $< $(ROOT_LIBFLAGS) $(sPHENIX_LIBFLAGS) $(LIBFLAGS) -lfun4all -lphool -lphparameter -lffarawobjects -lffamodules -lmbd -lglobalvertex -lcalo_reco
0067     # g++ -o $@ $< $(ROOT_CPPFLAGS) $(sPHENIX_CPPFLAGS) $(ROOT_LIBFLAGS) $(sPHENIX_LIBFLAGS) -lfun4all -lphool -lphparameter -lffarawobjects -lffamodules -lmbd -lglobalvertex -lcalo_reco
0068 
0069 
0070 #--- Cppcheck target ---
0071 # This target now creates/updates the stamp file if any SRCS are newer
0072 $(CPPCHECK_STAMP): $(SRCS)
0073         @echo "Running Cppcheck static analysis..."
0074     # Cppcheck command with all necessary include paths and suppressions
0075         cppcheck --std=c++20 --enable=all "-D R__LOAD_LIBRARY(X)=" \
0076         --suppress=missingIncludeSystem \
0077         --suppress=missingInclude \
0078         --force \
0079         --checkers-report=cppcheck_checkers.txt \
0080         --check-level=exhaustive \
0081         $(SRCS) # Check all source files explicitly listed in SRCS or a specific directory
0082         @touch $@ # Update the timestamp of the stamp file after successful run
0083 
0084 # Make the 'cppcheck' phony target depend on the actual stamp file target
0085 # This ensures 'make cppcheck' runs the stamp file rule
0086 cppcheck: $(CPPCHECK_STAMP)
0087 
0088 #--- Clean target ---
0089 clean:
0090         @echo "Cleaning up..."
0091         rm -rf bin/ # Remove the entire bin directory
0092         rm -f cppcheck_checkers.txt $(CPPCHECK_STAMP) # Remove the stamp file too
0093     # Add any other generated files to clean up here
0094 
0095 .PHONY: all cppcheck clean
0096 # end