-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
89 lines (70 loc) · 2.76 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#
# 'make depend' uses makedepend to automatically generate dependencies
# (dependencies are added to end of Makefile)
# 'make' build executable file 'mycc'
# 'make clean' removes all .o and executable files
#
# BR copied from http://www.cs.swarthmore.edu/~newhall/unixhelp/howto_makefiles.html
## BR definitions.
MYGSLDIR = /usr/local
# define the C compiler to use
CC = gcc
# define any compile-time flags
##CFLAGS = -Wall -g -DREALFLOAT
## nevermind, make the reals doubles!!
CFLAGS = -Wall -g -fopenmp
# define any directories containing header files other than /usr/include
#
MYINCLUDE = -I$(MYGSLDIR)/include
# define library paths in addition to /usr/lib
# if I wanted to include libraries not in /usr/lib I'd specify
# their path using -Lpath, something like:
LFLAGS = -lm -lgsl -lgslcblas
# define any libraries to link into executable:
# if I want to link in libraries (libx.so or libx.a) I use the -llibname
# option, something like (this will link in libmylib.so and libm.so:
MYLIB = -L$(MYGSLDIR)/lib
# define the C source files
# SRCS = cosmoutils.c misc.c readradecz.c xibin.c header.c readnbody.c xi.c xigrid.c
SRCS = header.c cosmoutils.c misc.c angupweight.c readradecz.c readnbody.c xigrid.c xibin.c computesepnbody.c computesepradecz.c countpairs.c output.c xi.c
# define the C object files
#
# This uses Suffix Replacement within a macro:
# $(name:string1=string2)
# For each word in 'name' replace 'string1' with 'string2'
# Below we are replacing the suffix .c of all words in the macro SRCS
# with the .o suffix
#
# define the executable file
MAIN = xi
all: $(MAIN)
@echo Compiled xi!
OBJS = $(SRCS:.c=.o)
header.o: header.h
misc.o: header.o
angupweight.o: header.o misc.o
cosmoutils.o: header.o misc.o
computesepnbody.o: header.o misc.o
computesepradecz.o: header.o misc.o
readradecz.o: header.o misc.o
readnbody.o: header.o misc.o
xibin.o: header.o misc.o
xigrid.o: header.o misc.o
output.o: header.o misc.o
countpairs.o: header.o misc.o xigrid.o computesepnbody.o computesepradecz.o angupweight.o
xi.o: header.o misc.o xibin.o readnbody.o readradecz.o angupweight.o countpairs.o output.o
#
# The following part of the makefile is generic; it can be used to
# build any executable just by changing the definitions above and by
# deleting dependencies appended to the file from 'make depend'
#
$(MAIN): $(OBJS)
$(CC) $(CFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS) $(LFLAGS) $(LIBS)
# this is a suffix replacement rule for building .o's from .c's
# it uses automatic variables $<: the name of the prerequisite of
# the rule(a .c file) and $@: the name of the target of the rule (a .o file)
# (see the gnu make manual section about automatic variables)
.c.o:
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
clean:
$(RM) *.o *~ $(MAIN)