Lua: Fix type confusion between signed and unsigned
[lsnes.git] / Makefile
blob7be43bea7787c671d63c61ec5781602f6eff768d
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 -pthread $(USER_CFLAGS)
16 ifdef BOOST_NEEDS_MT
17 BOOST_LIB_POSTFIX=-mt
18 endif
19 ifdef HOST_BOOST_NEEDS_MT
20 HOST_BOOST_POSTFIX=-mt
21 endif
23 LDFLAGS = -pthread -lboost_iostreams$(BOOST_LIB_POSTFIX) -lboost_filesystem$(BOOST_LIB_POSTFIX) -lboost_system$(BOOST_LIB_POSTFIX) -lz $(USER_LDFLAGS)
24 HOSTHELPER_LDFLAGS =
26 ifeq ($(THREADS), NATIVE)
27 CFLAGS += -DNATIVE_THREADS
28 else
29 ifeq ($(THREADS), BOOST)
30 CFLAGS += -DBOOST_THREADS
31 LDFLAGS += -lboost_thread$(BOOST_LIB_POSTFIX)
32 else
33 $(error "Bad value for THREADS (expected NATIVE or BOOST)")
34 endif
35 endif
37 ifeq ($(REGEX), BOOST)
38 CFLAGS += -DUSE_BOOST_REGEX
39 LDFLAGS += -lboost_regex$(BOOST_LIB_POSTFIX)
40 HOSTHELPER_LDFLAGS += -lboost_regex$(HOST_BOOST_POSTFIX)
41 endif
42 HOSTHELPER_LDFLAGS += -lboost_system$(HOST_BOOST_POSTFIX)
45 ifdef NEED_LIBICONV
46 LDFLAGS += -liconv
47 endif
49 ifdef USE_LIBGCRYPT
50 CFLAGS += -DUSE_LIBGCRYPT_SHA256
51 LDFLAGS += -lgcrypt -lgpg-error
52 endif
54 ifdef USE_LIBLZMA
55 CFLAGS += -DLIBLZMA_AVAILABLE
56 LDFLAGS += -llzma
57 endif
59 ifeq ($(ARCHITECTURE), I386)
60 CFLAGS += -DARCH_IS_I386
61 else
62 endif
65 export
67 all: src/__all_files__
69 CFLAGS += $(shell $(CROSS_PREFIX)pkg-config $(LUA) --cflags)
70 LDFLAGS += $(shell $(CROSS_PREFIX)pkg-config $(LUA) --libs)
71 CFLAGS += $(shell $(CROSS_PREFIX)curl-config --cflags)
72 LDFLAGS += $(shell $(CROSS_PREFIX)curl-config --libs)
74 compiler=$(subst ++,cc,$(REALCC))
75 gambatte_compiler=$(REALCC)
77 bsnes/out/libsnes.$(ARCHIVE_SUFFIX): forcelook
78 $(MAKE) -C bsnes $(BSNES_PROFILE_STRING) $(BSNES_TARGET_STRING)
79 $(REALRANLIB) bsnes/out/libsnes.$(ARCHIVE_SUFFIX)
82 src/__all_files__: src/core/version.cpp buildaux/mkdeps$(DOT_EXECUTABLE_SUFFIX) buildaux/txt2cstr$(DOT_EXECUTABLE_SUFFIX) forcelook
83 $(MAKE) -C src precheck
84 $(MAKE) -C src
85 cp src/lsnes$(DOT_EXECUTABLE_SUFFIX) .
87 buildaux/txt2cstr$(DOT_EXECUTABLE_SUFFIX): buildaux/txt2cstr.cpp
88 $(HOSTCC) $(HOSTCCFLAGS) -o $@ $<
89 buildaux/version$(DOT_EXECUTABLE_SUFFIX): buildaux/version.cpp VERSION
90 $(HOSTCC) $(HOSTCCFLAGS) -o $@ $<
91 buildaux/mkdeps$(DOT_EXECUTABLE_SUFFIX): buildaux/mkdeps.cpp VERSION
92 $(HOSTCC) $(HOSTCCFLAGS) -o $@ $< -lboost_filesystem$(HOST_BOOST_POSTFIX) -lboost_system$(HOST_BOOST_POSTFIX)
93 src/core/version.cpp: buildaux/version$(DOT_EXECUTABLE_SUFFIX) forcelook
94 buildaux/version$(DOT_EXECUTABLE_SUFFIX) >$@
96 platclean:
97 $(MAKE) -C src platclean
99 clean:
100 $(MAKE) -C src clean
101 rm -f buildaux/version$(DOT_EXECUTABLE_SUFFIX)
102 rm -f buildaux/mkdeps$(DOT_EXECUTABLE_SUFFIX)
103 rm -f buildaux/txt2cstr$(DOT_EXECUTABLE_SUFFIX)
105 forcelook:
106 @true