Save ROM name hints
[lsnes.git] / Makefile
blob39913a205cc0a6b0283facc28f948bf3c869547b
1 OPTIONS=options.build
2 include $(OPTIONS)
5 #Compilers.
6 REALCC = $(CROSS_PREFIX)$(CC)
7 REALLD = $(CROSS_PREFIX)$(LD)
8 REALRANLIB = $(CROSS_PREFIX)$(RANLIB)
10 ifeq ($(CORE_TYPE), BSNES)
11 CORE_PATH=$(shell pwd)/bsnes
12 CORE_SUBDIR=bsnes
13 CORE_OBJECT=bsnes/out/libsnes.$(ARCHIVE_SUFFIX)
14 CORE_DEFINE=-DCORETYPE_BSNES=1
15 ifdef BSNES_IS_COMPAT
16 CFLAGS += -DBSNES_IS_COMPAT
17 BSNES_PROFILE_STRING=profile=compatibility
18 else
19 BSNES_PROFILE_STRING=profile=accuracy
20 endif
21 ifeq ($(BSNES_VERSION), 084)
22 BSNES_PROFILE_STRING+=options=debugger
23 CFLAGS += -DBSNES_HAS_DEBUGGER
24 else
25 ifeq ($(BSNES_VERSION), 085)
26 BSNES_PROFILE_STRING+=options=debugger
27 CFLAGS += -DBSNES_HAS_DEBUGGER
28 endif
29 endif
31 ifeq ($(BSNES_VERSION), 087)
32 BSNES_TARGET_STRING=target=libsnes
33 else
34 BSNES_TARGET_STRING=ui=ui-libsnes
35 endif
36 CFLAGS += -DBSNES_V${BSNES_VERSION}
37 else
38 ifeq ($(CORE_TYPE), GAMBATTE)
39 CORE_PATH=$(shell pwd)/gambatte
40 CORE_SUBDIR=gambatte
41 CORE_OBJECT=gambatte/libgambatte/libgambatte.$(ARCHIVE_SUFFIX)
42 CORE_DEFINE=-DCORETYPE_GAMBATTE=1
43 BSNES_PROFILE_STRING=
44 BSNES_TARGET_STRING=
45 else
46 $(error "Bad value for CORETYPE (expected BSNES or GAMBATTE)")
47 endif
48 endif
50 #Flags.
51 HOSTCCFLAGS = -std=gnu++0x
52 CFLAGS += -I$(CORE_PATH) $(CORE_DEFINE) -std=gnu++0x $(USER_CFLAGS)
53 ifdef BOOST_NEEDS_MT
54 BOOST_LIB_POSTFIX=-mt
55 else
56 BOOST_LIB_POSTFIX=
57 endif
59 LDFLAGS = -lboost_iostreams$(BOOST_LIB_POSTFIX) -lboost_filesystem$(BOOST_LIB_POSTFIX) -lboost_system$(BOOST_LIB_POSTFIX) -lboost_regex$(BOOST_LIB_POSTFIX) -lz $(USER_LDFLAGS)
61 ifeq ($(THREADS), NATIVE)
62 CFLAGS += -DNATIVE_THREADS
63 else
64 ifeq ($(THREADS), BOOST)
65 CFLAGS += -DBOOST_THREADS
66 LDFLAGS += -lboost_thread$(BOOST_LIB_POSTFIX)
67 else
68 $(error "Bad value for THREADS (expected NATIVE or BOOST)")
69 endif
70 endif
73 export
75 all: src/__all_files__
79 compiler=$(subst ++,cc,$(REALCC))
80 gambatte_compiler=$(REALCC)
82 $(CORE_OBJECT): forcelook
83 $(MAKE) -C $(CORE_SUBDIR) $(BSNES_PROFILE_STRING) $(BSNES_TARGET_STRING)
84 $(REALRANLIB) $@
86 src/__all_files__: src/core/version.cpp forcelook $(CORE_OBJECT)
87 $(MAKE) -C src precheck
88 $(MAKE) -C src
89 cp src/lsnes$(DOT_EXECUTABLE_SUFFIX) .
91 buildaux/version.exe: buildaux/version.cpp VERSION
92 $(HOSTCC) $(HOSTCCFLAGS) -o $@ $<
93 src/core/version.cpp: buildaux/version.exe forcelook
94 buildaux/version.exe >$@
97 clean:
98 -$(MAKE) -C bsnes clean
99 -$(MAKE) -C gambatte clean
100 $(MAKE) -C src clean
102 forcelook:
103 @true