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-2025 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_
= $(PREFIX
)/share
41 INSTALL_SHARE
= $(DESTDIR
)$(INSTALL_SHARE_
)
42 INSTALL_DEFINC
= $(DPREFIX
)/include/luajit-
$(MMVERSION
)
43 INSTALL_INC
= $(INSTALL_DEFINC
)
45 export INSTALL_LJLIBD
= $(INSTALL_SHARE_
)/luajit-
$(MMVERSION
)
46 INSTALL_JITLIB
= $(DESTDIR
)$(INSTALL_LJLIBD
)/jit
47 INSTALL_LMODD
= $(INSTALL_SHARE
)/lua
48 INSTALL_LMOD
= $(INSTALL_LMODD
)/$(ABIVER
)
49 INSTALL_CMODD
= $(INSTALL_LIB
)/lua
50 INSTALL_CMOD
= $(INSTALL_CMODD
)/$(ABIVER
)
51 INSTALL_MAN
= $(INSTALL_SHARE
)/man
/man1
52 INSTALL_PKGCONFIG
= $(INSTALL_LIB
)/pkgconfig
54 INSTALL_TNAME
= luajit-
$(VERSION
)
55 INSTALL_TSYMNAME
= luajit
56 INSTALL_ANAME
= libluajit-
$(ABIVER
).a
57 INSTALL_SOSHORT1
= libluajit-
$(ABIVER
).so
58 INSTALL_SOSHORT2
= libluajit-
$(ABIVER
).so.
$(MAJVER
)
59 INSTALL_SONAME
= libluajit-
$(ABIVER
).so.
$(VERSION
)
60 INSTALL_DYLIBSHORT1
= libluajit-
$(ABIVER
).dylib
61 INSTALL_DYLIBSHORT2
= libluajit-
$(ABIVER
).
$(MAJVER
).dylib
62 INSTALL_DYLIBNAME
= libluajit-
$(ABIVER
).
$(VERSION
).dylib
63 INSTALL_PCNAME
= luajit.
pc
65 INSTALL_STATIC
= $(INSTALL_LIB
)/$(INSTALL_ANAME
)
66 INSTALL_DYN
= $(INSTALL_LIB
)/$(INSTALL_SONAME
)
67 INSTALL_SHORT1
= $(INSTALL_LIB
)/$(INSTALL_SOSHORT1
)
68 INSTALL_SHORT2
= $(INSTALL_LIB
)/$(INSTALL_SOSHORT2
)
69 INSTALL_T
= $(INSTALL_BIN
)/$(INSTALL_TNAME
)
70 INSTALL_TSYM
= $(INSTALL_BIN
)/$(INSTALL_TSYMNAME
)
71 INSTALL_PC
= $(INSTALL_PKGCONFIG
)/$(INSTALL_PCNAME
)
73 INSTALL_DIRS
= $(INSTALL_BIN
) $(INSTALL_LIB
) $(INSTALL_INC
) $(INSTALL_MAN
) \
74 $(INSTALL_PKGCONFIG
) $(INSTALL_JITLIB
) $(INSTALL_LMOD
) $(INSTALL_CMOD
)
75 UNINSTALL_DIRS
= $(INSTALL_JITLIB
) $(DESTDIR
)$(INSTALL_LJLIBD
) $(INSTALL_INC
) \
76 $(INSTALL_LMOD
) $(INSTALL_LMODD
) $(INSTALL_CMOD
) $(INSTALL_CMODD
)
80 RMDIR
= rmdir
2>/dev
/null
82 INSTALL_X
= install -m
0755
83 INSTALL_F
= install -m
0644
85 LDCONFIG
= ldconfig
-n
2>/dev
/null
86 SED_PC
= sed
-e
"s|^prefix=.*|prefix=$(PREFIX)|" \
87 -e
"s|^multilib=.*|multilib=$(MULTILIB)|" \
88 -e
"s|^relver=.*|relver=$(RELVER)|"
89 ifneq ($(INSTALL_DEFINC
),$(INSTALL_INC
))
90 SED_PC
+= -e
"s|^includedir=.*|includedir=$(INSTALL_INC)|"
98 FILES_INC
= lua.h lualib.h lauxlib.h luaconf.h lua.hpp luajit.h
99 FILES_JITLIB
= bc.lua bcsave.lua dump.lua p.lua v.lua zone.lua \
100 dis_x86.lua dis_x64.lua dis_arm.lua dis_arm64.lua \
101 dis_arm64be.lua dis_ppc.lua dis_mips.lua dis_mipsel.lua \
102 dis_mips64.lua dis_mips64el.lua \
103 dis_mips64r6.lua dis_mips64r6el.lua \
106 ifeq (,$(findstring Windows
,$(OS
)))
107 HOST_SYS
:= $(shell uname
-s
)
111 TARGET_SYS?
= $(HOST_SYS
)
113 ifeq (Darwin
,$(TARGET_SYS
))
114 INSTALL_SONAME
= $(INSTALL_DYLIBNAME
)
115 INSTALL_SOSHORT1
= $(INSTALL_DYLIBSHORT1
)
116 INSTALL_SOSHORT2
= $(INSTALL_DYLIBSHORT2
)
118 SED_PC
+= -e
"s| -Wl,-E||"
121 ##############################################################################
123 INSTALL_DEP
= src
/luajit
125 default
all $(INSTALL_DEP
):
126 @echo
"==== Building LuaJIT $(MMVERSION) ===="
128 @echo
"==== Successfully built LuaJIT $(MMVERSION) ===="
130 install: $(INSTALL_DEP
)
131 @echo
"==== Installing LuaJIT $(VERSION) to $(PREFIX) ===="
132 $(MKDIR
) $(INSTALL_DIRS
)
133 cd src
&& $(INSTALL_X
) $(FILE_T
) $(INSTALL_T
)
134 cd src
&& test -f
$(FILE_A
) && $(INSTALL_F
) $(FILE_A
) $(INSTALL_STATIC
) ||
:
135 $(RM
) $(INSTALL_DYN
) $(INSTALL_SHORT1
) $(INSTALL_SHORT2
)
136 cd src
&& test -f
$(FILE_SO
) && \
137 $(INSTALL_X
) $(FILE_SO
) $(INSTALL_DYN
) && \
138 ( $(LDCONFIG
) $(INSTALL_LIB
) ||
: ) && \
139 $(SYMLINK
) $(INSTALL_SONAME
) $(INSTALL_SHORT1
) && \
140 $(SYMLINK
) $(INSTALL_SONAME
) $(INSTALL_SHORT2
) ||
:
141 cd etc
&& $(INSTALL_F
) $(FILE_MAN
) $(INSTALL_MAN
)
142 cd etc
&& $(SED_PC
) $(FILE_PC
) > $(FILE_PC
).tmp
&& \
143 $(INSTALL_F
) $(FILE_PC
).tmp
$(INSTALL_PC
) && \
145 cd src
&& $(INSTALL_F
) $(FILES_INC
) $(INSTALL_INC
)
146 cd src
/jit
&& $(INSTALL_F
) $(FILES_JITLIB
) $(INSTALL_JITLIB
)
147 $(SYMLINK
) $(INSTALL_TNAME
) $(INSTALL_TSYM
)
148 @echo
"==== Successfully installed LuaJIT $(VERSION) to $(PREFIX) ===="
151 @echo
"==== Uninstalling LuaJIT $(VERSION) from $(PREFIX) ===="
152 $(UNINSTALL
) $(INSTALL_TSYM
) $(INSTALL_T
) $(INSTALL_STATIC
) $(INSTALL_DYN
) $(INSTALL_SHORT1
) $(INSTALL_SHORT2
) $(INSTALL_MAN
)/$(FILE_MAN
) $(INSTALL_PC
)
153 for file in
$(FILES_JITLIB
); do \
154 $(UNINSTALL
) $(INSTALL_JITLIB
)/$$file; \
156 for file in
$(FILES_INC
); do \
157 $(UNINSTALL
) $(INSTALL_INC
)/$$file; \
159 $(LDCONFIG
) $(INSTALL_LIB
)
160 $(RMDIR
) $(UNINSTALL_DIRS
) ||
:
161 @echo
"==== Successfully uninstalled LuaJIT $(VERSION) from $(PREFIX) ===="
163 ##############################################################################
166 @echo
"==== Building LuaJIT $(MMVERSION) (amalgamation) ===="
168 @echo
"==== Successfully built LuaJIT $(MMVERSION) (amalgamation) ===="
173 .PHONY
: all install amalg
clean
175 ##############################################################################