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-2023 Mike Pall. See Copyright Notice in luajit.h
14 ##############################################################################
20 # LuaJIT uses rolling releases. The release version is based on the time of
21 # the latest git commit. The 'git' command must be available during the build.
22 RELVER
= $(shell cat src
/luajit_relver.txt
2>/dev
/null ||
: )
23 # Note: setting it with := doesn't work, since it will change during the build.
25 MMVERSION
= $(MAJVER
).
$(MINVER
)
26 VERSION
= $(MMVERSION
).
$(RELVER
)
28 ##############################################################################
30 # Change the installation path as needed. This automatically adjusts
31 # the paths in src/luaconf.h, too. Note: PREFIX must be an absolute path!
33 export PREFIX
= /usr
/local
35 ##############################################################################
37 DPREFIX
= $(DESTDIR
)$(PREFIX
)
38 INSTALL_BIN
= $(DPREFIX
)/bin
39 INSTALL_LIB
= $(DPREFIX
)/$(MULTILIB
)
40 INSTALL_SHARE
= $(DPREFIX
)/share
41 INSTALL_DEFINC
= $(DPREFIX
)/include/luajit-
$(MMVERSION
)
42 INSTALL_INC
= $(INSTALL_DEFINC
)
44 INSTALL_LJLIBD
= $(INSTALL_SHARE
)/luajit-
$(MMVERSION
)
45 INSTALL_JITLIB
= $(INSTALL_LJLIBD
)/jit
46 INSTALL_LMODD
= $(INSTALL_SHARE
)/lua
47 INSTALL_LMOD
= $(INSTALL_LMODD
)/$(ABIVER
)
48 INSTALL_CMODD
= $(INSTALL_LIB
)/lua
49 INSTALL_CMOD
= $(INSTALL_CMODD
)/$(ABIVER
)
50 INSTALL_MAN
= $(INSTALL_SHARE
)/man
/man1
51 INSTALL_PKGCONFIG
= $(INSTALL_LIB
)/pkgconfig
53 INSTALL_TNAME
= luajit-
$(VERSION
)
54 INSTALL_TSYMNAME
= luajit
55 INSTALL_ANAME
= libluajit-
$(ABIVER
).a
56 INSTALL_SOSHORT1
= libluajit-
$(ABIVER
).so
57 INSTALL_SOSHORT2
= libluajit-
$(ABIVER
).so.
$(MAJVER
)
58 INSTALL_SONAME
= libluajit-
$(ABIVER
).so.
$(VERSION
)
59 INSTALL_DYLIBSHORT1
= libluajit-
$(ABIVER
).dylib
60 INSTALL_DYLIBSHORT2
= libluajit-
$(ABIVER
).
$(MAJVER
).dylib
61 INSTALL_DYLIBNAME
= libluajit-
$(ABIVER
).
$(VERSION
).dylib
62 INSTALL_PCNAME
= luajit.
pc
64 INSTALL_STATIC
= $(INSTALL_LIB
)/$(INSTALL_ANAME
)
65 INSTALL_DYN
= $(INSTALL_LIB
)/$(INSTALL_SONAME
)
66 INSTALL_SHORT1
= $(INSTALL_LIB
)/$(INSTALL_SOSHORT1
)
67 INSTALL_SHORT2
= $(INSTALL_LIB
)/$(INSTALL_SOSHORT2
)
68 INSTALL_T
= $(INSTALL_BIN
)/$(INSTALL_TNAME
)
69 INSTALL_TSYM
= $(INSTALL_BIN
)/$(INSTALL_TSYMNAME
)
70 INSTALL_PC
= $(INSTALL_PKGCONFIG
)/$(INSTALL_PCNAME
)
72 INSTALL_DIRS
= $(INSTALL_BIN
) $(INSTALL_LIB
) $(INSTALL_INC
) $(INSTALL_MAN
) \
73 $(INSTALL_PKGCONFIG
) $(INSTALL_JITLIB
) $(INSTALL_LMOD
) $(INSTALL_CMOD
)
74 UNINSTALL_DIRS
= $(INSTALL_JITLIB
) $(INSTALL_LJLIBD
) $(INSTALL_INC
) \
75 $(INSTALL_LMOD
) $(INSTALL_LMODD
) $(INSTALL_CMOD
) $(INSTALL_CMODD
)
79 RMDIR
= rmdir
2>/dev
/null
81 INSTALL_X
= install -m
0755
82 INSTALL_F
= install -m
0644
84 LDCONFIG
= ldconfig
-n
2>/dev
/null
85 SED_PC
= sed
-e
"s|^prefix=.*|prefix=$(PREFIX)|" \
86 -e
"s|^multilib=.*|multilib=$(MULTILIB)|" \
87 -e
"s|^relver=.*|relver=$(RELVER)|"
88 ifneq ($(INSTALL_DEFINC
),$(INSTALL_INC
))
89 SED_PC
+= -e
"s|^includedir=.*|includedir=$(INSTALL_INC)|"
97 FILES_INC
= lua.h lualib.h lauxlib.h luaconf.h lua.hpp luajit.h
98 FILES_JITLIB
= bc.lua v.lua dump.lua dis_x86.lua dis_x64.lua dis_arm.lua \
99 dis_ppc.lua dis_mips.lua dis_mipsel.lua bcsave.lua vmdef.lua
101 ifeq (,$(findstring Windows
,$(OS
)))
102 HOST_SYS
:= $(shell uname
-s
)
106 TARGET_SYS?
= $(HOST_SYS
)
108 ifeq (Darwin
,$(TARGET_SYS
))
109 INSTALL_SONAME
= $(INSTALL_DYLIBNAME
)
110 INSTALL_SOSHORT1
= $(INSTALL_DYLIBSHORT1
)
111 INSTALL_SOSHORT2
= $(INSTALL_DYLIBSHORT2
)
115 ##############################################################################
117 INSTALL_DEP
= src
/luajit
119 default
all $(INSTALL_DEP
):
120 @echo
"==== Building LuaJIT $(MMVERSION) ===="
122 @echo
"==== Successfully built LuaJIT $(MMVERSION) ===="
124 install: $(INSTALL_DEP
)
125 @echo
"==== Installing LuaJIT $(VERSION) to $(PREFIX) ===="
126 $(MKDIR
) $(INSTALL_DIRS
)
127 cd src
&& $(INSTALL_X
) $(FILE_T
) $(INSTALL_T
)
128 cd src
&& test -f
$(FILE_A
) && $(INSTALL_F
) $(FILE_A
) $(INSTALL_STATIC
) ||
:
129 $(RM
) $(INSTALL_TSYM
) $(INSTALL_DYN
) $(INSTALL_SHORT1
) $(INSTALL_SHORT2
)
130 cd src
&& test -f
$(FILE_SO
) && \
131 $(INSTALL_X
) $(FILE_SO
) $(INSTALL_DYN
) && \
132 ( $(LDCONFIG
) $(INSTALL_LIB
) ||
: ) && \
133 $(SYMLINK
) $(INSTALL_SONAME
) $(INSTALL_SHORT1
) && \
134 $(SYMLINK
) $(INSTALL_SONAME
) $(INSTALL_SHORT2
) ||
:
135 cd etc
&& $(INSTALL_F
) $(FILE_MAN
) $(INSTALL_MAN
)
136 cd etc
&& $(SED_PC
) $(FILE_PC
) > $(FILE_PC
).tmp
&& \
137 $(INSTALL_F
) $(FILE_PC
).tmp
$(INSTALL_PC
) && \
139 cd src
&& $(INSTALL_F
) $(FILES_INC
) $(INSTALL_INC
)
140 cd src
/jit
&& $(INSTALL_F
) $(FILES_JITLIB
) $(INSTALL_JITLIB
)
141 $(SYMLINK
) $(INSTALL_TNAME
) $(INSTALL_TSYM
)
142 @echo
"==== Successfully installed LuaJIT $(VERSION) to $(PREFIX) ===="
145 @echo
"==== Uninstalling LuaJIT $(VERSION) from $(PREFIX) ===="
146 $(UNINSTALL
) $(INSTALL_TSYM
) $(INSTALL_T
) $(INSTALL_STATIC
) $(INSTALL_DYN
) $(INSTALL_SHORT1
) $(INSTALL_SHORT2
) $(INSTALL_MAN
)/$(FILE_MAN
) $(INSTALL_PC
)
147 for file in
$(FILES_JITLIB
); do \
148 $(UNINSTALL
) $(INSTALL_JITLIB
)/$$file; \
150 for file in
$(FILES_INC
); do \
151 $(UNINSTALL
) $(INSTALL_INC
)/$$file; \
153 $(LDCONFIG
) $(INSTALL_LIB
)
154 $(RMDIR
) $(UNINSTALL_DIRS
) ||
:
155 @echo
"==== Successfully uninstalled LuaJIT $(VERSION) from $(PREFIX) ===="
157 ##############################################################################
160 @echo
"==== Building LuaJIT $(MMVERSION) (amalgamation) ===="
162 @echo
"==== Successfully built LuaJIT $(MMVERSION) (amalgamation) ===="
167 .PHONY
: all install amalg
clean
169 ##############################################################################