lsnes_lua_state -> lsnes_instance.lua
[lsnes.git] / Makefile
blob7ad59f55c18a658abe7ebee2528b0d8e4fdfe8c9
1 OPTIONS=options.build
2 include $(OPTIONS)
4 ifndef LUA
5 LUA=lua
6 endif
8 #Compilers.
9 REALCC = $(CROSS_PREFIX)$(CC)
10 REALLD = $(CROSS_PREFIX)$(LD)
11 REALRANLIB = $(CROSS_PREFIX)$(RANLIB)
13 #Flags.
14 HOSTCCFLAGS = -std=gnu++0x
15 CFLAGS += -std=gnu++0x $(USER_CFLAGS)
16 ifdef BOOST_NEEDS_MT
17 BOOST_LIB_POSTFIX=-mt
18 else
19 BOOST_LIB_POSTFIX=
20 endif
21 ifdef HOST_BOOST_NEEDS_MT
22 HOST_BOOST_LIB_POSTFIX=-mt
23 else
24 HOST_BOOST_LIB_POSTFIX=
25 endif
27 LDFLAGS = -lboost_iostreams$(BOOST_LIB_POSTFIX) -lboost_filesystem$(BOOST_LIB_POSTFIX) -lboost_system$(BOOST_LIB_POSTFIX) -lboost_regex$(BOOST_LIB_POSTFIX) -lz $(USER_LDFLAGS)
29 ifeq ($(THREADS), NATIVE)
30 CFLAGS += -DNATIVE_THREADS
31 else
32 ifeq ($(THREADS), BOOST)
33 CFLAGS += -DBOOST_THREADS
34 LDFLAGS += -lboost_thread$(BOOST_LIB_POSTFIX)
35 else
36 $(error "Bad value for THREADS (expected NATIVE or BOOST)")
37 endif
38 endif
40 ifdef NEED_LIBICONV
41 LDFLAGS += -liconv
42 endif
44 ifdef USE_LIBGCRYPT
45 CFLAGS += -DUSE_LIBGCRYPT_SHA256
46 LDFLAGS += -lgcrypt -lgpg-error
47 endif
49 ifdef USE_LIBLZMA
50 CFLAGS += -DLIBLZMA_AVAILABLE
51 LDFLAGS += -llzma
52 endif
54 ifeq ($(ARCHITECTURE), I386)
55 CFLAGS += -DARCH_IS_I386
56 else
57 endif
60 export
62 all: src/__all_files__
64 CFLAGS += $(shell $(CROSS_PREFIX)pkg-config $(LUA) --cflags)
65 LDFLAGS += $(shell $(CROSS_PREFIX)pkg-config $(LUA) --libs)
66 CFLAGS += $(shell $(CROSS_PREFIX)curl-config --cflags)
67 LDFLAGS += $(shell $(CROSS_PREFIX)curl-config --libs)
69 compiler=$(subst ++,cc,$(REALCC))
70 gambatte_compiler=$(REALCC)
72 bsnes/out/libsnes.$(ARCHIVE_SUFFIX): forcelook
73 $(MAKE) -C bsnes $(BSNES_PROFILE_STRING) $(BSNES_TARGET_STRING)
74 $(REALRANLIB) bsnes/out/libsnes.$(ARCHIVE_SUFFIX)
77 src/__all_files__: src/core/version.cpp buildaux/mkdeps.exe buildaux/txt2cstr.exe forcelook
78 $(MAKE) -C src precheck
79 $(MAKE) -C src
80 cp src/lsnes$(DOT_EXECUTABLE_SUFFIX) .
82 buildaux/txt2cstr.exe: buildaux/txt2cstr.cpp
83 $(HOSTCC) $(HOSTCCFLAGS) -o $@ $<
84 buildaux/version.exe: buildaux/version.cpp VERSION
85 $(HOSTCC) $(HOSTCCFLAGS) -o $@ $<
86 buildaux/mkdeps.exe: buildaux/mkdeps.cpp VERSION
87 $(HOSTCC) $(HOSTCCFLAGS) -o $@ $< -lboost_filesystem$(HOST_BOOST_LIB_POSTFIX) -lboost_system$(HOST_BOOST_LIB_POSTFIX)
88 src/core/version.cpp: buildaux/version.exe forcelook
89 buildaux/version.exe >$@
91 platclean:
92 $(MAKE) -C src platclean
94 clean:
95 $(MAKE) -C src clean
96 rm -f buildaux/version.exe
98 forcelook:
99 @true