-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
55 lines (35 loc) · 1.21 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
.EXPORT_ALL_VARIABLES:
.SUFFIXES:
.PHONY: clean all
# := is only evaluated once
SHELL = /bin/sh
NAME = Mc2root
ROOTLIBS := $(shell root-config --libs)
ROOTINC := -I$(shell root-config --incdir)
INCLUDES = -I.
CC = gcc
CXX = g++
CPPFLAGS = $(ROOTINC) $(INCLUDES) -fPIC
CXXFLAGS = -std=c++11 -pedantic -Wall -g -O3
LDFLAGS = -g -fPIC
LDLIBS = $(ROOTLIBS)
# for root: add a $(NAME)Dictionary.o
#LOADLIBES = \
# $(NAME)Dictionary.o
# -------------------- implicit rules --------------------
# n.o made from n.c by $(CC) -c $(CPPFLAGS) $(CFLAGS)
# n.o made from n.cc by $(CXX) -c $(CPPFLAGS) $(CXXFLAGS)
# n made from n.o by $(CC) $(LDFLAGS) n.o $(LOADLIBES) $(LDLIBS)
# -------------------- rules --------------------
all: $(NAME)
@echo Done
# -------------------- pattern rules --------------------
# this rule sets the name of the .cxx file at the beginning of the line (easier to find)
%.o: %.cxx %.hh
$(CXX) $< -c $(CPPFLAGS) $(CXXFLAGS) -o $@
# -------------------- default rule for executables --------------------
%: %.cxx $(LOADLIBES)
$(CXX) $< $(CXXFLAGS) $(CPPFLAGS) $(LOADLIBES) $(LDLIBS) -o $@
# -------------------- clean --------------------
clean:
rm -f $(NAME) *.o