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 bcsave.lua dump.lua p.lua v.lua zone.lua \
99 dis_x86.lua dis_x64.lua dis_arm.lua dis_arm64.lua \
100 dis_arm64be.lua dis_ppc.lua dis_mips.lua dis_mipsel.lua \
101 dis_mips64.lua dis_mips64el.lua \
102 dis_mips64r6.lua dis_mips64r6el.lua \
105 ifeq (,$(findstring Windows
,$(OS
)))
106 HOST_SYS
:= $(shell uname
-s
)
110 TARGET_SYS?
= $(HOST_SYS
)
112 ifeq (Darwin
,$(TARGET_SYS
))
113 INSTALL_SONAME
= $(INSTALL_DYLIBNAME
)
114 INSTALL_SOSHORT1
= $(INSTALL_DYLIBSHORT1
)
115 INSTALL_SOSHORT2
= $(INSTALL_DYLIBSHORT2
)
119 ##############################################################################
121 INSTALL_DEP
= src
/luajit
123 default
all $(INSTALL_DEP
):
124 @echo
"==== Building LuaJIT $(MMVERSION) ===="
126 @echo
"==== Successfully built LuaJIT $(MMVERSION) ===="
128 install: $(INSTALL_DEP
)
129 @echo
"==== Installing LuaJIT $(VERSION) to $(PREFIX) ===="
130 $(MKDIR
) $(INSTALL_DIRS
)
131 cd src
&& $(INSTALL_X
) $(FILE_T
) $(INSTALL_T
)
132 cd src
&& test -f
$(FILE_A
) && $(INSTALL_F
) $(FILE_A
) $(INSTALL_STATIC
) ||
:
133 $(RM
) $(INSTALL_DYN
) $(INSTALL_SHORT1
) $(INSTALL_SHORT2
)
134 cd src
&& test -f
$(FILE_SO
) && \
135 $(INSTALL_X
) $(FILE_SO
) $(INSTALL_DYN
) && \
136 ( $(LDCONFIG
) $(INSTALL_LIB
) ||
: ) && \
137 $(SYMLINK
) $(INSTALL_SONAME
) $(INSTALL_SHORT1
) && \
138 $(SYMLINK
) $(INSTALL_SONAME
) $(INSTALL_SHORT2
) ||
:
139 cd etc
&& $(INSTALL_F
) $(FILE_MAN
) $(INSTALL_MAN
)
140 cd etc
&& $(SED_PC
) $(FILE_PC
) > $(FILE_PC
).tmp
&& \
141 $(INSTALL_F
) $(FILE_PC
).tmp
$(INSTALL_PC
) && \
143 cd src
&& $(INSTALL_F
) $(FILES_INC
) $(INSTALL_INC
)
144 cd src
/jit
&& $(INSTALL_F
) $(FILES_JITLIB
) $(INSTALL_JITLIB
)
145 $(SYMLINK
) $(INSTALL_TNAME
) $(INSTALL_TSYM
)
146 @echo
"==== Successfully installed LuaJIT $(VERSION) to $(PREFIX) ===="
149 @echo
"==== Uninstalling LuaJIT $(VERSION) from $(PREFIX) ===="
150 $(UNINSTALL
) $(INSTALL_TSYM
) $(INSTALL_T
) $(INSTALL_STATIC
) $(INSTALL_DYN
) $(INSTALL_SHORT1
) $(INSTALL_SHORT2
) $(INSTALL_MAN
)/$(FILE_MAN
) $(INSTALL_PC
)
151 for file in
$(FILES_JITLIB
); do \
152 $(UNINSTALL
) $(INSTALL_JITLIB
)/$$file; \
154 for file in
$(FILES_INC
); do \
155 $(UNINSTALL
) $(INSTALL_INC
)/$$file; \
157 $(LDCONFIG
) $(INSTALL_LIB
)
158 $(RMDIR
) $(UNINSTALL_DIRS
) ||
:
159 @echo
"==== Successfully uninstalled LuaJIT $(VERSION) from $(PREFIX) ===="
161 ##############################################################################
164 @echo
"==== Building LuaJIT $(MMVERSION) (amalgamation) ===="
166 @echo
"==== Successfully built LuaJIT $(MMVERSION) (amalgamation) ===="
171 .PHONY
: all install amalg
clean
173 ##############################################################################