-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (48 loc) · 1.28 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
FF_FILES = $(wildcard source/*.f)
EX_FILES = $(wildcard ../commons/*.f)
OBJ_DIR = obj
LIBRARY = -L/usr/lib64/cernlib/2006/lib -lgfortran #-lpdflib804
OBJ_FILES = $(patsubst source/%.f,$(OBJ_DIR)/%.o,$(FF_FILES))
EXT_FILES = $(patsubst external/%.f,$(OBJ_DIR)/%.o,$(EX_FILES))
LIB_FILES = $(EXT_FILES) $(OBJ_FILES)
VPATH = source/ ../commons/
###############################################################################
FC = gfortran
FFLAGS = -g -w
CC = g++
CFLAGS = -lgfortran -Wall -I$(RHEAD) -lrt -std=c++11
RFLAGS = $(shell root-config --cflags)
RLIBS = $(shell root-config --libs)
RHEAD = $(shell root-config --incdir)
RM = /bin/rm
RMFLAGS = -rf
.PHONY: all
all: lpair
#
# Make the executable
#
lpair: $(OBJ_DIR)/main.opp $(LIB_FILES)
@echo "Linking..."
@$(CC) $(CFLAGS) -o $@ $^ $(LIBRARY) $(RLIBS)
@echo "Done!"
xsect: $(OBJ_DIR)/xsect.opp $(LIB_FILES)
@echo "Linking $<..."
@$(CC) $(CFLAGS) -o $@ $^ $(LIBRARY)
@echo "Done!"
nice:
@$(RM) $(RMFLAGS) *.o $(OBJ_DIR)
clean: nice
@$(RM) $(RMFLAGS) lpair
#
# Make the objects
#
$(OBJ_DIR)/%.o: %.f
@echo "Building "$<
@$(FC) -c $(FFLAGS) $< -o $@
$(OBJ_DIR)/%.opp: %.cpp | $(OBJ_DIR)
@echo "Building "$<
@$(CC) $(CFLAGS) -c $(RFLAGS) $< -o $@
$(OBJ_FILES): | $(OBJ_DIR)
$(EXT_FILES): | $(OBJ_DIR)
$(OBJ_DIR):
@mkdir -p $(OBJ_DIR)