forked from GRIFFINCollaboration/CommandLineInterface
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (44 loc) · 1.84 KB
/
Makefile
File metadata and controls
67 lines (44 loc) · 1.84 KB
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
60
61
62
63
64
65
66
67
.EXPORT_ALL_VARIABLES:
.SUFFIXES:
.PHONY: clean all
SHELL = /bin/sh
LIB_DIR = $(HOME)/lib
ROOTCFLAGS := $(shell root-config --cflags)
ROOTLIBS := $(shell root-config --libs)
ROOTGLIBS := $(shell root-config --glibs)
ROOTINC := -I$(shell root-config --incdir)
INCLUDES = -I.
LIBRARIES =
CC = gcc
CXX = g++
CPPFLAGS = $(ROOTINC) $(INCLUDES) -fPIC
CXXFLAGS = -std=c++11 -pedantic -Wall -Wno-long-long -g -O3
LDFLAGS = -g -fPIC
LDLIBS = -L$(LIB_DIR) $(ROOTLIBS) $(addprefix -l,$(LIBRARIES)) -lm
LOADLIBES = CommandLineInterface.o Utilities.o TextAttributes.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 --------------------
# for library: add $(LIB_DIR)/lib$(NAME).so
all: libCommandLineInterface.so libUtilities.so libTextAttributes.so
@echo Done
# -------------------- libraries --------------------
lib%.so: %.o
@ mkdir -p $(LIB_DIR)
$(CXX) $(LDFLAGS) -shared -o $(LIB_DIR)/$@.1.0.1 $< $(LDLIBS) -lc
@ ln -sf $(LIB_DIR)/$@.1.0.1 $(LIB_DIR)/$@
# -------------------- pattern rules --------------------
# this rule sets the name of the .cc file at the beginning of the line (easier to find)
%.o: %.cc %.hh
$(CXX) $< -c $(CPPFLAGS) $(CXXFLAGS) -o $@
# -------------------- default rule for executables --------------------
%: %.cc $(LOADLIBES)
$(CXX) $< $(CXXFLAGS) $(CPPFLAGS) $(LOADLIBES) $(LDLIBS) -o $@
tar:
@echo "creating zipped tar-ball ... "
tar -chvzf CommandLineInterface.tar.gz CommandLineInterface.cc CommandLineInterface.hh Makefile test.cc Utilities.cc Utilities.hh TextAttributes.cc TextAttributes.hh
#--------------------------------------------------
clean:
rm -f *.o