x86/x64: Add more red zone checks to assembler backend.
[luajit-2.0.git] / Makefile
blob792d7e5698a30212d6701b28acbb6a0b6ef545a8
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 ##############################################################################
16 MAJVER= 2
17 MINVER= 0
18 ABIVER= 5.1
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
34 export MULTILIB= lib
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)
77 RM= rm -f
78 MKDIR= mkdir -p
79 RMDIR= rmdir 2>/dev/null
80 SYMLINK= ln -sf
81 INSTALL_X= install -m 0755
82 INSTALL_F= install -m 0644
83 UNINSTALL= $(RM)
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)|"
90 endif
92 FILE_T= luajit
93 FILE_A= libluajit.a
94 FILE_SO= libluajit.so
95 FILE_MAN= luajit.1
96 FILE_PC= luajit.pc
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)
103 else
104 HOST_SYS= Windows
105 endif
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)
112 LDCONFIG= :
113 endif
115 ##############################################################################
117 INSTALL_DEP= src/luajit
119 default all $(INSTALL_DEP):
120 @echo "==== Building LuaJIT $(MMVERSION) ===="
121 $(MAKE) -C src
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) && \
138 $(RM) $(FILE_PC).tmp
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) ===="
144 uninstall:
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; \
149 done
150 for file in $(FILES_INC); do \
151 $(UNINSTALL) $(INSTALL_INC)/$$file; \
152 done
153 $(LDCONFIG) $(INSTALL_LIB)
154 $(RMDIR) $(UNINSTALL_DIRS) || :
155 @echo "==== Successfully uninstalled LuaJIT $(VERSION) from $(PREFIX) ===="
157 ##############################################################################
159 amalg:
160 @echo "==== Building LuaJIT $(MMVERSION) (amalgamation) ===="
161 $(MAKE) -C src amalg
162 @echo "==== Successfully built LuaJIT $(MMVERSION) (amalgamation) ===="
164 clean:
165 $(MAKE) -C src clean
167 .PHONY: all install amalg clean
169 ##############################################################################