PPC: Fuse BSWAP with XLOAD/XSTORE to lwbrx/stwbrx.
[luajit-2.0.git] / Makefile
blob6c5cfcfcff45a9389b12b6030e8618eb855878ef
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-2011 Mike Pall. See Copyright Notice in luajit.h
14 ##############################################################################
16 MAJVER= 2
17 MINVER= 0
18 RELVER= 0
19 PREREL= -beta8
20 VERSION= $(MAJVER).$(MINVER).$(RELVER)$(PREREL)
21 ABIVER= 5.1
22 NODOTABIVER= 51
24 ##############################################################################
26 # Change the installation path as needed. This automatically adjusts
27 # the paths in src/luaconf.h, too. Note: PREFIX must be an absolute path!
29 export PREFIX= /usr/local
30 ##############################################################################
32 DPREFIX= $(DESTDIR)$(PREFIX)
33 INSTALL_BIN= $(DPREFIX)/bin
34 INSTALL_LIB= $(DPREFIX)/lib
35 INSTALL_SHARE= $(DPREFIX)/share
36 INSTALL_INC= $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER)
38 INSTALL_JITLIB= $(INSTALL_SHARE)/luajit-$(VERSION)/jit
39 INSTALL_LMOD= $(INSTALL_SHARE)/lua/$(ABIVER)
40 INSTALL_CMOD= $(INSTALL_LIB)/lua/$(ABIVER)
41 INSTALL_MAN= $(INSTALL_SHARE)/man/man1
42 INSTALL_PKGCONFIG= $(INSTALL_LIB)/pkgconfig
44 INSTALL_TNAME= luajit-$(VERSION)
45 INSTALL_TSYMNAME= luajit
46 INSTALL_ANAME= libluajit-$(ABIVER).a
47 INSTALL_SONAME= libluajit-$(ABIVER).so.$(MAJVER).$(MINVER).$(RELVER)
48 INSTALL_SOSHORT= libluajit-$(ABIVER).so
49 INSTALL_DYLIBNAME= libluajit-$(NODOTABIVER).$(MAJVER).$(MINVER).$(RELVER).dylib
50 INSTALL_DYLIBSHORT1= libluajit-$(NODOTABIVER).dylib
51 INSTALL_DYLIBSHORT2= libluajit-$(NODOTABIVER).$(MAJVER).dylib
52 INSTALL_PCNAME= luajit.pc
54 INSTALL_STATIC= $(INSTALL_LIB)/$(INSTALL_ANAME)
55 INSTALL_DYN= $(INSTALL_LIB)/$(INSTALL_SONAME)
56 INSTALL_SHORT1= $(INSTALL_LIB)/$(INSTALL_SOSHORT)
57 INSTALL_SHORT2= $(INSTALL_LIB)/$(INSTALL_SOSHORT)
58 INSTALL_T= $(INSTALL_BIN)/$(INSTALL_TNAME)
59 INSTALL_TSYM= $(INSTALL_BIN)/$(INSTALL_TSYMNAME)
60 INSTALL_PC= $(INSTALL_PKGCONFIG)/$(INSTALL_PCNAME)
62 INSTALL_DIRS= $(INSTALL_BIN) $(INSTALL_LIB) $(INSTALL_INC) $(INSTALL_MAN) \
63 $(INSTALL_PKGCONFIG) $(INSTALL_JITLIB) $(INSTALL_LMOD) $(INSTALL_CMOD)
65 RM= rm -f
66 MKDIR= mkdir -p
67 SYMLINK= ln -sf
68 INSTALL_X= install -m 0755
69 INSTALL_F= install -m 0644
70 LDCONFIG= ldconfig -n
71 SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|"
73 FILE_T= luajit
74 FILE_A= libluajit.a
75 FILE_SO= libluajit.so
76 FILE_MAN= luajit.1
77 FILE_PC= luajit.pc
78 FILES_INC= lua.h lualib.h lauxlib.h luaconf.h lua.hpp luajit.h
79 FILES_JITLIB= bc.lua v.lua dump.lua dis_x86.lua dis_x64.lua dis_arm.lua \
80 bcsave.lua vmdef.lua
82 ifeq (,$(findstring Windows,$(OS)))
83 ifeq (Darwin,$(shell uname -s))
84 INSTALL_SONAME= $(INSTALL_DYLIBNAME)
85 INSTALL_SHORT1= $(INSTALL_LIB)/$(INSTALL_DYLIBSHORT1)
86 INSTALL_SHORT2= $(INSTALL_LIB)/$(INSTALL_DYLIBSHORT2)
87 LDCONFIG= :
88 endif
89 endif
91 ##############################################################################
93 INSTALL_DEP= src/luajit
95 default all $(INSTALL_DEP):
96 @echo "==== Building LuaJIT $(VERSION) ===="
97 $(MAKE) -C src
98 @echo "==== Successfully built LuaJIT $(VERSION) ===="
100 install: $(INSTALL_DEP)
101 @echo "==== Installing LuaJIT $(VERSION) to $(PREFIX) ===="
102 $(MKDIR) $(INSTALL_DIRS)
103 cd src && $(INSTALL_X) $(FILE_T) $(INSTALL_T)
104 cd src && test -f $(FILE_A) && $(INSTALL_F) $(FILE_A) $(INSTALL_STATIC) || :
105 $(RM) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2)
106 cd src && test -f $(FILE_SO) && \
107 $(INSTALL_X) $(FILE_SO) $(INSTALL_DYN) && \
108 $(LDCONFIG) $(INSTALL_LIB) && \
109 $(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT1) && \
110 $(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT2) || :
111 cd etc && $(INSTALL_F) $(FILE_MAN) $(INSTALL_MAN)
112 cd etc && $(SED_PC) $(FILE_PC) > $(FILE_PC).tmp && \
113 $(INSTALL_F) $(FILE_PC).tmp $(INSTALL_PC) && \
114 $(RM) $(FILE_PC).tmp
115 cd src && $(INSTALL_F) $(FILES_INC) $(INSTALL_INC)
116 cd lib && $(INSTALL_F) $(FILES_JITLIB) $(INSTALL_JITLIB)
117 @echo "==== Successfully installed LuaJIT $(VERSION) to $(PREFIX) ===="
118 @echo ""
119 @echo "Note: the beta releases deliberately do NOT install a symlink for luajit"
120 @echo "You can do this now by running this command (with sudo):"
121 @echo ""
122 @echo " $(SYMLINK) $(INSTALL_TNAME) $(INSTALL_TSYM)"
123 @echo ""
125 ##############################################################################
127 amalg:
128 @echo "Building LuaJIT $(VERSION)"
129 $(MAKE) -C src amalg
131 clean:
132 $(MAKE) -C src clean
134 cleaner:
135 $(MAKE) -C src cleaner
137 distclean:
138 $(MAKE) -C src distclean
140 .PHONY: all install amalg clean cleaner distclean
142 ##############################################################################