-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
38 lines (29 loc) · 993 Bytes
/
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
# Ed Callaghan
# G4 example Makefile
# October 2023
EXE := example
SRC := main.cpp
CPPFLAGS := -g -Og -gdwarf-2
CPPFLAGS := $(CPPFLAGS) -I./include
CPPFLAGS := $(CPPFLAGS) $(shell clhep-config --include)
CPPFLAGS := $(CPPFLAGS) $(shell geant4-config --cflags)
CPPFLAGS := $(CPPFLAGS) $(shell root-config --cflags)
CPPFLAGS := $(CPPFLAGS) -I$(RYML_DIR)/include
LDFLAGS := $(LDFLAGS) $(shell clhep-config --libs)
LDFLAGS := $(LDFLAGS) $(shell geant4-config --libs)
LDFLAGS := $(LDFLAGS) $(shell root-config --libs)
LDFLAGS := $(LDFLAGS) -L$(RYML_DIR)/lib -lryml
LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs xerces-c)
SRCDIR := ./src
OBJDIR := ./build
SRCS := $(wildcard $(SRCDIR)/*.cpp)
OBJS := $(addprefix $(OBJDIR)/, $(notdir $(SRCS:.cpp=.o)))
all: compile
compile: $(EXE) $(OBJS)
$(EXE): $(SRC) $(OBJS)
$(CXX) -o $@ $(CPPFLAGS) $^ $(LDFLAGS)
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
$(CXX) -o $@ -c $(CPPFLAGS) $^
clean:
rm -f $(EXE) $(wildcard $(OBJDIR)/*.o)
.PHONY: clean