1 ##############################################################################
2 # LuaJIT top level Makefile for installation. Requires GNU Make.
4 # Please read doc/install.html before changing any variables!
6 # Suitable for POSIX platforms (Linux, *BSD, OSX etc.).
7 # Note: src/Makefile has many more configurable options.
9 # ##### This Makefile is NOT useful for Windows! #####
10 # For MSVC, please follow the instructions given in src/msvcbuild.bat.
11 # For MinGW and Cygwin, cd to src and run make with the Makefile there.
13 # Copyright (C) 2005-2012 Mike Pall. See Copyright Notice in luajit.h
14 ##############################################################################
19 VERSION
= $(MAJVER
).
$(MINVER
).
$(RELVER
)
22 ##############################################################################
24 # Change the installation path as needed. This automatically adjusts
25 # the paths in src/luaconf.h, too. Note: PREFIX must be an absolute path!
27 export PREFIX
= /usr
/local
28 ##############################################################################
30 DPREFIX
= $(DESTDIR
)$(PREFIX
)
31 INSTALL_BIN
= $(DPREFIX
)/bin
32 INSTALL_LIB
= $(DPREFIX
)/lib
33 INSTALL_SHARE
= $(DPREFIX
)/share
34 INSTALL_INC
= $(DPREFIX
)/include/luajit-
$(MAJVER
).
$(MINVER
)
36 INSTALL_LJLIBD
= $(INSTALL_SHARE
)/luajit-
$(VERSION
)
37 INSTALL_JITLIB
= $(INSTALL_LJLIBD
)/jit
38 INSTALL_LMODD
= $(INSTALL_SHARE
)/lua
39 INSTALL_LMOD
= $(INSTALL_LMODD
)/$(ABIVER
)
40 INSTALL_CMODD
= $(INSTALL_LIB
)/lua
41 INSTALL_CMOD
= $(INSTALL_CMODD
)/$(ABIVER
)
42 INSTALL_MAN
= $(INSTALL_SHARE
)/man
/man1
43 INSTALL_PKGCONFIG
= $(INSTALL_LIB
)/pkgconfig
45 INSTALL_TNAME
= luajit-
$(VERSION
)
46 INSTALL_TSYMNAME
= luajit
47 INSTALL_ANAME
= libluajit-
$(ABIVER
).a
48 INSTALL_SONAME
= libluajit-
$(ABIVER
).so.
$(MAJVER
).
$(MINVER
).
$(RELVER
)
49 INSTALL_SOSHORT
= libluajit-
$(ABIVER
).so
50 INSTALL_DYLIBNAME
= libluajit-
$(ABIVER
).
$(MAJVER
).
$(MINVER
).
$(RELVER
).dylib
51 INSTALL_DYLIBSHORT1
= libluajit-
$(ABIVER
).dylib
52 INSTALL_DYLIBSHORT2
= libluajit-
$(ABIVER
).
$(MAJVER
).dylib
53 INSTALL_PCNAME
= luajit.
pc
55 INSTALL_STATIC
= $(INSTALL_LIB
)/$(INSTALL_ANAME
)
56 INSTALL_DYN
= $(INSTALL_LIB
)/$(INSTALL_SONAME
)
57 INSTALL_SHORT1
= $(INSTALL_LIB
)/$(INSTALL_SOSHORT
)
58 INSTALL_SHORT2
= $(INSTALL_LIB
)/$(INSTALL_SOSHORT
)
59 INSTALL_T
= $(INSTALL_BIN
)/$(INSTALL_TNAME
)
60 INSTALL_TSYM
= $(INSTALL_BIN
)/$(INSTALL_TSYMNAME
)
61 INSTALL_PC
= $(INSTALL_PKGCONFIG
)/$(INSTALL_PCNAME
)
63 INSTALL_DIRS
= $(INSTALL_BIN
) $(INSTALL_LIB
) $(INSTALL_INC
) $(INSTALL_MAN
) \
64 $(INSTALL_PKGCONFIG
) $(INSTALL_JITLIB
) $(INSTALL_LMOD
) $(INSTALL_CMOD
)
65 UNINSTALL_DIRS
= $(INSTALL_JITLIB
) $(INSTALL_LJLIBD
) $(INSTALL_INC
) \
66 $(INSTALL_LMOD
) $(INSTALL_LMODD
) $(INSTALL_CMOD
) $(INSTALL_CMODD
)
70 RMDIR
= rmdir
2>/dev
/null
72 INSTALL_X
= install -m
0755
73 INSTALL_F
= install -m
0644
76 SED_PC
= sed
-e
"s|^prefix=.*|prefix=$(PREFIX)|"
83 FILES_INC
= lua.h lualib.h lauxlib.h luaconf.h lua.hpp luajit.h
84 FILES_JITLIB
= bc.lua v.lua dump.lua dis_x86.lua dis_x64.lua dis_arm.lua \
85 dis_ppc.lua dis_mips.lua dis_mipsel.lua bcsave.lua vmdef.lua
87 ifeq (,$(findstring Windows
,$(OS
)))
88 ifeq (Darwin
,$(shell uname
-s
))
89 INSTALL_SONAME
= $(INSTALL_DYLIBNAME
)
90 INSTALL_SHORT1
= $(INSTALL_LIB
)/$(INSTALL_DYLIBSHORT1
)
91 INSTALL_SHORT2
= $(INSTALL_LIB
)/$(INSTALL_DYLIBSHORT2
)
96 ##############################################################################
98 INSTALL_DEP
= src
/luajit
100 default
all $(INSTALL_DEP
):
101 @echo
"==== Building LuaJIT $(VERSION) ===="
103 @echo
"==== Successfully built LuaJIT $(VERSION) ===="
105 install: $(INSTALL_DEP
)
106 @echo
"==== Installing LuaJIT $(VERSION) to $(PREFIX) ===="
107 $(MKDIR
) $(INSTALL_DIRS
)
108 cd src
&& $(INSTALL_X
) $(FILE_T
) $(INSTALL_T
)
109 cd src
&& test -f
$(FILE_A
) && $(INSTALL_F
) $(FILE_A
) $(INSTALL_STATIC
) ||
:
110 $(RM
) $(INSTALL_TSYM
) $(INSTALL_DYN
) $(INSTALL_SHORT1
) $(INSTALL_SHORT2
)
111 cd src
&& test -f
$(FILE_SO
) && \
112 $(INSTALL_X
) $(FILE_SO
) $(INSTALL_DYN
) && \
113 $(LDCONFIG
) $(INSTALL_LIB
) && \
114 $(SYMLINK
) $(INSTALL_SONAME
) $(INSTALL_SHORT1
) && \
115 $(SYMLINK
) $(INSTALL_SONAME
) $(INSTALL_SHORT2
) ||
:
116 cd etc
&& $(INSTALL_F
) $(FILE_MAN
) $(INSTALL_MAN
)
117 cd etc
&& $(SED_PC
) $(FILE_PC
) > $(FILE_PC
).tmp
&& \
118 $(INSTALL_F
) $(FILE_PC
).tmp
$(INSTALL_PC
) && \
120 cd src
&& $(INSTALL_F
) $(FILES_INC
) $(INSTALL_INC
)
121 cd src
/jit
&& $(INSTALL_F
) $(FILES_JITLIB
) $(INSTALL_JITLIB
)
122 $(SYMLINK
) $(INSTALL_TNAME
) $(INSTALL_TSYM
)
123 @echo
"==== Successfully installed LuaJIT $(VERSION) to $(PREFIX) ===="
126 @echo
"==== Uninstalling LuaJIT $(VERSION) from $(PREFIX) ===="
127 $(UNINSTALL
) $(INSTALL_TSYM
) $(INSTALL_T
) $(INSTALL_STATIC
) $(INSTALL_DYN
) $(INSTALL_SHORT1
) $(INSTALL_SHORT2
) $(INSTALL_MAN
)/$(FILE_MAN
) $(INSTALL_PC
)
128 for file in
$(FILES_JITLIB
); do \
129 $(UNINSTALL
) $(INSTALL_JITLIB
)/$$file; \
131 for file in
$(FILES_INC
); do \
132 $(UNINSTALL
) $(INSTALL_INC
)/$$file; \
134 $(LDCONFIG
) $(INSTALL_LIB
)
135 $(RMDIR
) $(UNINSTALL_DIRS
) ||
:
136 @echo
"==== Successfully uninstalled LuaJIT $(VERSION) from $(PREFIX) ===="
138 ##############################################################################
141 @echo
"Building LuaJIT $(VERSION)"
147 .PHONY
: all install amalg
clean
149 ##############################################################################