-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (61 loc) · 1.64 KB
/
Makefile
File metadata and controls
78 lines (61 loc) · 1.64 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
70
71
72
73
74
75
76
77
78
# ------------------------------------------------------------------------------
# lua-mpi build instructions
# ------------------------------------------------------------------------------
#
# 1. Make sure you have the MPI sources installed.
#
# 2. Create a file called Makefile.in which contains macros like these:
#
# CC = mpicc
# LUA_HOME = /path/to/lua-5.2.1
#
# # Additional compile flags are optional:
#
# CFLAGS = -Wall -O2
# LVER = lua-5.2.1 # can be lua-5.1 or other
#
#
# 3. Optionally, you may install local Lua sources by typing `make lua`.
#
#
# 4. Run `make`.
#
# ------------------------------------------------------------------------------
MAKEFILE_IN = Makefile.in
include $(MAKEFILE_IN)
CFLAGS ?= -Wall -shared -fPIC
CURL ?= curl
UNTAR ?= tar -xvf
CD ?= cd
RM ?= rm -f
OS ?= generic
LVER ?= lua-5.2.1
LUA_I ?= -I$(LUA_HOME)/include
LUA_L ?= -L$(LUA_HOME)/lib -llua
default : main MPI.so buffer.so
lua : $(LVER)
$(LVER) :
$(CURL) http://www.lua.org/ftp/$(LVER).tar.gz -o $(LVER).tar.gz
$(UNTAR) $(LVER).tar.gz
$(CD) $(LVER); $(MAKE) $(OS) CC=$(CC); \
$(MAKE) install INSTALL_TOP=$(PWD)/$(LVER)
$(RM) $(LVER).tar.gz
mpifuncs.c :
python readspec.py > $@
lua-mpi.o : lua-mpi.c mpifuncs.c
$(CC) $(CFLAGS) -c -o $@ $< $(LUA_I)
buffer.o : buffer.c
$(CC) $(CFLAGS) -c -o $@ $< $(LUA_I)
main.o : main.c
$(CC) $(CFLAGS) -c -o $@ $< $(LUA_I)
main : main.o lua-mpi.o buffer.o
$(CC) -o $@ $^ $(LUA_L)
clean :
$(RM) *.o mpifuncs.c main
MPI.so: lua-mpi.o
$(CC) $(CFLAGS) -o $@ $< $(LUA_I) $(LUA_L)
buffer.so: buffer.o
$(CC) $(CFLAGS) -o $@ $< $(LUA_I) $(LUA_L)
# Also remove local Lua sources
realclean : clean
$(RM) -r $(LVER)