summaryrefslogtreecommitdiff
path: root/Build/source/libs/luajit/Makefile.am
blob: e32186a5f79367cc5dfcfce556d72c01838c4af1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
## Proxy Makefile.am to build LuaJIT for TeX Live.
##
## Copyright (C) 2014 Luigi Scarso <luigi.scarso@gmail.com>
## Copyright (C) 2014 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.
##
## We want to re-distribute the whole original LuaJIT source tree.
##
EXTRA_DIST = $(LUAJIT_TREE)

## Changes applied to the original source tree
##
EXTRA_DIST += $(LUAJIT_TREE)-PATCHES

# in case of an SVN repository
dist-hook:
	rm -rf `find $(distdir) -name .svn -o -name .deps -o -name .dirstamp -o -name '*.$(OBJEXT)'`

AM_CPPFLAGS = -I$(srcdir)/$(LUAJIT_TREE)/src $(LUAJIT_DEFINES)
AM_CFLAGS = -Wall

SUBDIRS = . native include

noinst_LIBRARIES = libluajit.a

nodist_libluajit_a_SOURCES = \
	$(ljlib_sources) \
	@LUAJIT_TREE@/src/lbitlib.c \
	@LUAJIT_TREE@/src/lib_aux.c \
	@LUAJIT_TREE@/src/lib_init.c \
	@LUAJIT_TREE@/src/lj_alloc.c \
	@LUAJIT_TREE@/src/lj_api.c \
	@LUAJIT_TREE@/src/lj_asm.c \
	@LUAJIT_TREE@/src/lj_bc.c \
	@LUAJIT_TREE@/src/lj_bcread.c \
	@LUAJIT_TREE@/src/lj_bcwrite.c \
	@LUAJIT_TREE@/src/lj_carith.c \
	@LUAJIT_TREE@/src/lj_ccall.c \
	@LUAJIT_TREE@/src/lj_ccallback.c \
	@LUAJIT_TREE@/src/lj_cconv.c \
	@LUAJIT_TREE@/src/lj_cdata.c \
	@LUAJIT_TREE@/src/lj_char.c \
	@LUAJIT_TREE@/src/lj_clib.c \
	@LUAJIT_TREE@/src/lj_cparse.c \
	@LUAJIT_TREE@/src/lj_crecord.c \
	@LUAJIT_TREE@/src/lj_ctype.c \
	@LUAJIT_TREE@/src/lj_debug.c \
	@LUAJIT_TREE@/src/lj_dispatch.c \
	@LUAJIT_TREE@/src/lj_err.c \
	@LUAJIT_TREE@/src/lj_ffrecord.c \
	@LUAJIT_TREE@/src/lj_func.c \
	@LUAJIT_TREE@/src/lj_gc.c \
	@LUAJIT_TREE@/src/lj_gdbjit.c \
	@LUAJIT_TREE@/src/lj_ir.c \
	@LUAJIT_TREE@/src/lj_lex.c \
	@LUAJIT_TREE@/src/lj_lib.c \
	@LUAJIT_TREE@/src/lj_load.c \
	@LUAJIT_TREE@/src/lj_mcode.c \
	@LUAJIT_TREE@/src/lj_meta.c \
	@LUAJIT_TREE@/src/lj_obj.c \
	@LUAJIT_TREE@/src/lj_opt_dce.c \
	@LUAJIT_TREE@/src/lj_opt_fold.c \
	@LUAJIT_TREE@/src/lj_opt_loop.c \
	@LUAJIT_TREE@/src/lj_opt_mem.c \
	@LUAJIT_TREE@/src/lj_opt_narrow.c \
	@LUAJIT_TREE@/src/lj_opt_sink.c \
	@LUAJIT_TREE@/src/lj_opt_split.c \
	@LUAJIT_TREE@/src/lj_parse.c \
	@LUAJIT_TREE@/src/lj_record.c \
	@LUAJIT_TREE@/src/lj_snap.c \
	@LUAJIT_TREE@/src/lj_state.c \
	@LUAJIT_TREE@/src/lj_str.c \
	@LUAJIT_TREE@/src/lj_strscan.c \
	@LUAJIT_TREE@/src/lj_tab.c \
	@LUAJIT_TREE@/src/lj_trace.c \
	@LUAJIT_TREE@/src/lj_udata.c \
	@LUAJIT_TREE@/src/lj_vmevent.c \
	@LUAJIT_TREE@/src/lj_vmmath.c


if PEOBJ
libluajit_a_LIBADD = lj_vm_obj.o
else !PEOBJ
nodist_libluajit_a_SOURCES += lj_vm_asm.s
endif !PEOBJ

ljlib_sources = \
	lib_base.c \
	lib_math.c \
	lib_bit.c \
	lib_string.c \
	lib_table.c \
	lib_io.c \
	lib_os.c \
	lib_package.c \
	lib_debug.c \
	lib_jit.c \
	lib_ffi.c

$(libluajit_a_OBJECTS): $(HDRGEN)

# When cross-compiling, EXEEXT for the build and host systems may differ.
# Thus we depend on the auxiliary file native/buildvm-stamp.
native/buildvm-stamp: $(ljlib_sources)
	cd native && $(MAKE) $(AM_MAKEFLAGS) buildvm-stamp

HDRGEN = lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h

lj_bcdef.h: native/buildvm-stamp
	$(AM_V_GEN)native/buildvm -m bcdef -o $@ $(ljlib_sources)

lj_ffdef.h: native/buildvm-stamp
	$(AM_V_GEN)native/buildvm -m ffdef -o $@ $(ljlib_sources)

lj_libdef.h: native/buildvm-stamp
	$(AM_V_GEN)native/buildvm -m libdef -o $@ $(ljlib_sources)

lj_recdef.h: native/buildvm-stamp
	$(AM_V_GEN)native/buildvm -m recdef -o $@ $(ljlib_sources)

lj_folddef.h: native/buildvm-stamp $(LUAJIT_TREE)/src/lj_opt_fold.c
	$(AM_V_GEN)native/buildvm -m folddef -o $@ $(srcdir)/$(LUAJIT_TREE)/src/lj_opt_fold.c

lj_vm_obj.o lj_vm_asm.s: native/buildvm-stamp
	$(AM_V_GEN)native/buildvm -m $(LJVM_MODE) -o $@

$(ljlib_sources): config.force
	@test -f $@ || { rm -f $@; \
	  if $(AM_V_P); then echo "$(LN_S) $(srcdir)/$(LUAJIT_TREE)/src/$@ $@"; \
	    else echo "  LINK     $@"; fi; \
	  $(LN_S) $(srcdir)/$(LUAJIT_TREE)/src/$@ $@; } || exit 1

CLEANFILES = $(HDRGEN) $(ljlib_sources) lj_vm_asm.s

CONFIG_CLEAN_FILES = dynasm_flags native_flags

if build
check_PROGRAMS = jittest luajittry
dist_check_SCRIPTS = luajit.test luajiterr.test
TESTS = luajit.test luajiterr.test
endif build

jittest_SOURCES = jittest.c

jittest_CPPFLAGS = -Iinclude

nodist_luajittry_SOURCES = @LUAJIT_TREE@/src/luajit.c

luajittry_CPPFLAGS = -Iinclude
luajittry_LDFLAGS = $(LUAJIT_LDEXTRA)

LDADD = libluajit.a

EXTRA_DIST += jiterr.exp
CLEANFILES += jiterr.out jiterr.tmp

# Reconfig
reconfig_prereq =
DISTCLEANFILES =

include $(srcdir)/../../am/reconfig.am

# Rebuild
rebuild_prereq =
rebuild_target = all

include $(srcdir)/../../am/rebuild.am