-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (47 loc) · 1.65 KB
/
Makefile
File metadata and controls
69 lines (47 loc) · 1.65 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
68
69
# Makefile for sort code for 32S(p,d) experiment with Hyperion
# Made 11/28/2017
# Sean Burcher
# Adapted from Makefile for his2root by Cory Thornsberry
##################################################################
CC=g++
CFLAGS = -fPIC -Wall -O3 -std=c++0x `root-config --cflags` -Iinclude
LDLIBS = -lstdc++ `root-config --libs`
LDFLAGS = `root-config --glibs`
# Directories
TOP_LEVEL = $(shell pwd)
INCLUDE_DIR = $(TOP_LEVEL)/include
SOURCE_DIR = $(TOP_LEVEL)/src
OBJ_DIR = $(TOP_LEVEL)/obj
INSTALL_DIR = ~/bin
# Executables
SORT = sort
SORT_SRC = $(SOURCE_DIR)/sort.cpp
SORT_OBJ = $(OBJ_DIR)/sort.o
#####################################################################
all: $(OBJ_DIR) $(SORT)
# Create all directories, make all objects, and link executable
#####################################################################
$(OBJ_DIR):
# Make the object file directory
@if [ ! -d $@ ]; then \
echo "Making directory: "$@; \
mkdir $@; \
fi
#####################################################################
$(OBJ_DIR)/%.o: $(SOURCE_DIR)/%.cpp
# Compile C++ source files
$(CC) -c $(CFLAGS) $< -o $@
#####################################################################
$(SORT): $(OBJECTS) $(SORT_OBJ)
$(CC) $(LDFLAGS) $(OBJECTS) $(SORT_OBJ) -o $@ $(LDLIBS)
#####################################################################
install: $(SORT)
# Install tools into the install directory
@echo "Installing tools to "$(INSTALL_DIR)
@ln -s -f $(TOP_LEVEL)/$(SORT) $(INSTALL_DIR)/sort
#####################################################################
tidy: clean
@rm -f $(SORT)
@rm -f $(INSTALL_DIR)/sort
clean:
@rm -f $(OBJ_DIR)/*.o