new beta-0.90.0
[luatex.git] / source / libs / luajit / Makefile.am
bloba74eed38601413f5d6e084c6bf82c24adb512c11
1 ## Proxy Makefile.am to build LuaJIT for TeX Live.
2 ##
3 ## Copyright (C) 2014 Luigi Scarso <luigi.scarso@gmail.com>
4 ## Copyright (C) 2014, 2015 Peter Breitenlohner <tex-live@tug.org>
5 ## You may freely use, modify and/or distribute this file.
6 ##
7 ## We want to re-distribute the whole original LuaJIT source tree.
8 ##
9 EXTRA_DIST = $(LUAJIT_TREE)
11 ## Changes applied to the original source tree
13 EXTRA_DIST += LuaJIT-PATCHES
15 # Files not to be distributed
16 include $(srcdir)/../../am/dist_hook.am
17 NEVER_NAMES += $(NEVER_NAMES_SUB) $(NEVER_NAMES_LT)
19 AM_CPPFLAGS = -I$(srcdir)/$(LUAJIT_TREE)/src $(LUAJIT_DEFINES) -U_FORTIFY_SOURCE
20 AM_CFLAGS = $(LUAJIT_CFLAGS) $(LUAJIT_HAS_NOT_LOG2) -Wall
21 AM_CCASFLAGS = $(LUAJIT_CFLAGS) $(LUAJIT_HAS_NOT_LOG2)
23 SUBDIRS = . native include
25 lib_LTLIBRARIES = libtexluajit.la
27 libtexluajit_la_LDFLAGS = -bindir @bindir@ -no-undefined -version-info $(LUAJIT_LT_VERSINFO) $(LIBLUAJIT_LDEXTRA)
29 dist_libtexluajit_la_SOURCES = \
30         lbitlib.c
32 nodist_libtexluajit_la_SOURCES = \
33         $(ljlib_sources) \
34         @LUAJIT_TREE@/src/lib_aux.c \
35         @LUAJIT_TREE@/src/lib_init.c \
36         @LUAJIT_TREE@/src/lj_alloc.c \
37         @LUAJIT_TREE@/src/lj_api.c \
38         @LUAJIT_TREE@/src/lj_asm.c \
39         @LUAJIT_TREE@/src/lj_bc.c \
40         @LUAJIT_TREE@/src/lj_bcread.c \
41         @LUAJIT_TREE@/src/lj_bcwrite.c \
42         @LUAJIT_TREE@/src/lj_buf.c \
43         @LUAJIT_TREE@/src/lj_carith.c \
44         @LUAJIT_TREE@/src/lj_ccall.c \
45         @LUAJIT_TREE@/src/lj_ccallback.c \
46         @LUAJIT_TREE@/src/lj_cconv.c \
47         @LUAJIT_TREE@/src/lj_cdata.c \
48         @LUAJIT_TREE@/src/lj_char.c \
49         @LUAJIT_TREE@/src/lj_clib.c \
50         @LUAJIT_TREE@/src/lj_cparse.c \
51         @LUAJIT_TREE@/src/lj_crecord.c \
52         @LUAJIT_TREE@/src/lj_ctype.c \
53         @LUAJIT_TREE@/src/lj_debug.c \
54         @LUAJIT_TREE@/src/lj_dispatch.c \
55         @LUAJIT_TREE@/src/lj_err.c \
56         @LUAJIT_TREE@/src/lj_ffrecord.c \
57         @LUAJIT_TREE@/src/lj_func.c \
58         @LUAJIT_TREE@/src/lj_gc.c \
59         @LUAJIT_TREE@/src/lj_gdbjit.c \
60         @LUAJIT_TREE@/src/lj_ir.c \
61         @LUAJIT_TREE@/src/lj_lex.c \
62         @LUAJIT_TREE@/src/lj_lib.c \
63         @LUAJIT_TREE@/src/lj_load.c \
64         @LUAJIT_TREE@/src/lj_mcode.c \
65         @LUAJIT_TREE@/src/lj_meta.c \
66         @LUAJIT_TREE@/src/lj_obj.c \
67         @LUAJIT_TREE@/src/lj_opt_dce.c \
68         @LUAJIT_TREE@/src/lj_opt_fold.c \
69         @LUAJIT_TREE@/src/lj_opt_loop.c \
70         @LUAJIT_TREE@/src/lj_opt_mem.c \
71         @LUAJIT_TREE@/src/lj_opt_narrow.c \
72         @LUAJIT_TREE@/src/lj_opt_sink.c \
73         @LUAJIT_TREE@/src/lj_opt_split.c \
74         @LUAJIT_TREE@/src/lj_parse.c \
75         @LUAJIT_TREE@/src/lj_profile.c \
76         @LUAJIT_TREE@/src/lj_record.c \
77         @LUAJIT_TREE@/src/lj_snap.c \
78         @LUAJIT_TREE@/src/lj_state.c \
79         @LUAJIT_TREE@/src/lj_str.c \
80         @LUAJIT_TREE@/src/lj_strfmt.c \
81         @LUAJIT_TREE@/src/lj_strfmt_num.c \
82         @LUAJIT_TREE@/src/lj_strscan.c \
83         @LUAJIT_TREE@/src/lj_tab.c \
84         @LUAJIT_TREE@/src/lj_trace.c \
85         @LUAJIT_TREE@/src/lj_udata.c \
86         @LUAJIT_TREE@/src/lj_vmevent.c \
87         @LUAJIT_TREE@/src/lj_vmmath.c
89 if PEOBJ
90 libtexluajit_la_LIBADD = lj_vm_obj.lo
91 else !PEOBJ
92 nodist_libtexluajit_la_SOURCES += lj_vm_asm.S
93 endif !PEOBJ
95 ljlib_sources = \
96         lib_base.c \
97         lib_math.c \
98         lib_bit.c \
99         lib_string.c \
100         lib_table.c \
101         lib_io.c \
102         lib_os.c \
103         lib_package.c \
104         lib_debug.c \
105         lib_jit.c \
106         lib_ffi.c
108 $(libtexluajit_la_OBJECTS): $(HDRGEN)
110 # When cross-compiling, EXEEXT for the build and host systems may differ.
111 # Thus we depend on the auxiliary file native/buildvm-stamp.
112 native/buildvm-stamp: $(ljlib_sources) lj_opt_fold.c
113         cd native && $(MAKE) $(AM_MAKEFLAGS) buildvm-stamp
115 HDRGEN = lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h
117 lj_bcdef.h: native/buildvm-stamp
118         $(AM_V_GEN)native/buildvm -m bcdef -o $@ $(ljlib_sources)
120 lj_ffdef.h: native/buildvm-stamp
121         $(AM_V_GEN)native/buildvm -m ffdef -o $@ $(ljlib_sources)
123 lj_libdef.h: native/buildvm-stamp
124         $(AM_V_GEN)native/buildvm -m libdef -o $@ $(ljlib_sources)
126 lj_recdef.h: native/buildvm-stamp
127         $(AM_V_GEN)native/buildvm -m recdef -o $@ $(ljlib_sources)
129 lj_folddef.h: native/buildvm-stamp
130         $(AM_V_GEN)native/buildvm -m folddef -o $@ lj_opt_fold.c
132 lj_vm_obj.o lj_vm_asm.S: native/buildvm-stamp
133         $(AM_V_GEN)native/buildvm -m $(LJVM_MODE) -o $@
135 lj_vm_obj.lo: lj_vm_obj.o lib_base.lo
136         $(AM_V_GEN)sed 's/lib_base/lj_vm_obj/' lib_base.lo >$@ \
137           && . ./$@ && test x"$$pic_object" == xnone \
138           || cp lj_vm_obj.o .libs/lj_vm_obj.o
140 $(ljlib_sources) lj_opt_fold.c: config.force
141         @test -f $@ || { rm -f $@; \
142           if $(AM_V_P); then echo "$(LN_S) $(srcdir)/$(LUAJIT_TREE)/src/$@ $@"; \
143             else echo "  LINK     $@"; fi; \
144           $(LN_S) $(srcdir)/$(LUAJIT_TREE)/src/$@ $@; } || exit 1
146 CLEANFILES = $(HDRGEN) $(ljlib_sources) lj_opt_fold.c lj_vm_asm.S
148 CONFIG_CLEAN_FILES = dynasm_flags native_flags system_flags
150 luajitincludedir = ${includedir}/texluajit
152 luajitinclude_HEADERS = \
153         $(LUAJIT_TREE)/src/lauxlib.h \
154         $(LUAJIT_TREE)/src/luaconf.h \
155         $(LUAJIT_TREE)/src/luajit.h \
156         $(LUAJIT_TREE)/src/lua.h \
157         $(LUAJIT_TREE)/src/lua.hpp \
158         $(LUAJIT_TREE)/src/lualib.h
160 pkgconfigdir = ${libdir}/pkgconfig
162 pkgconfig_DATA = texluajit.pc
164 if build
165 check_PROGRAMS = jittest luajittry
166 dist_check_SCRIPTS = luajit.test luajiterr.test
167 TESTS = luajit.test luajiterr.test
168 endif build
169 luajit.log: jittest$(EXEEXT)
170 luajiterr.log: luajittry$(EXEEXT)
172 jittest_SOURCES = jittest.c
174 jittest_CPPFLAGS = -Iinclude $(LUAJIT_DEFINES)
176 nodist_luajittry_SOURCES = @LUAJIT_TREE@/src/luajit.c
178 luajittry_CPPFLAGS = -Iinclude $(LUAJIT_DEFINES)
179 luajittry_LDFLAGS = $(LUAJIT_LDEXTRA)
181 LDADD = libtexluajit.la
183 EXTRA_DIST += jiterr.exp
184 CLEANFILES += jiterr.out jiterr.tmp
186 # Reconfig
187 reconfig_prereq =
188 DISTCLEANFILES =
190 include $(srcdir)/../../am/reconfig.am
192 # Rebuild
193 rebuild_prereq =
194 rebuild_target = all
196 include $(srcdir)/../../am/rebuild.am