lsnes rr2-β24
[lsnes.git] / src / Makefile
blobb96e006f7bbf58ce1267a55e2be1acb692394414
1 __all_files__: util/__all_files__ \
2 lsnes$(DOT_EXECUTABLE_SUFFIX) \
3 $(patsubst %.cpp,%.util$(DOT_EXECUTABLE_SUFFIX),$(wildcard util/*.cpp))
5 ifndef NO_RDYNAMIC
6 LDFLAGS += -rdynamic
7 endif
8 ifdef NO_DLFCN
9 CFLAGS += -DNO_DLFCN
10 else
11 LDFLAGS += -ldl
12 endif
14 ifdef BOOST_FILESYSTEM3
15 CFLAGS += -DBOOST_FILESYSTEM3
16 endif
18 ifdef OPUS_CODEC
19 CFLAGS += -DWITH_OPUS_CODEC $(shell $(CROSS_PREFIX)pkg-config --cflags opus)
20 LDFLAGS += $(shell $(CROSS_PREFIX)pkg-config --libs opus)
21 ifdef OPUS_CODEC_SUPPORTS_SURROUND
22 CFLAGS += -DOPUS_SUPPORTS_SURROUND
23 endif
24 endif
26 COMMON_LIBRARY=core lua fonts library interface video emulation cmdhelp
27 ALLFILES=__all__.files
28 ALLFLAGS=__all__.ldflags
29 COMMON_LIBRARY_FILES=$(patsubst %,%/$(ALLFILES),$(COMMON_LIBRARY))
30 COMMON_LIBRARY_FLAGS=$(patsubst %,%/$(ALLFLAGS),$(COMMON_LIBRARY))
31 PLATFORM_LIBRARY_FILES=platform/$(ALLFILES)
32 PLATFORM_LIBRARY_FLAGS=platform/$(ALLFLAGS)
34 __all_common__.files: $(COMMON_LIBRARY_FILES)
35 lua genfilelist.lua $^ >$@
37 __all_platform__.files: $(PLATFORM_LIBRARY_FILES)
38 lua genfilelist.lua $^ >$@
40 core/$(ALLFILES): forcelook cmdhelp/$(ALLFILES)
41 $(MAKE) -C core
43 emulation/$(ALLFILES): forcelook
44 $(MAKE) -C emulation
46 fonts/$(ALLFILES): forcelook
47 $(MAKE) -C fonts
49 library/$(ALLFILES): forcelook
50 $(MAKE) -C library
52 interface/$(ALLFILES): forcelook
53 $(MAKE) -C interface
55 lua/$(ALLFILES): forcelook
56 $(MAKE) -C lua
58 platform/$(ALLFILES): forcelook
59 $(MAKE) -C platform
61 cmdhelp/$(ALLFILES): forcelook
62 $(MAKE) -C cmdhelp
64 util/__all_files__: forcelook
65 $(MAKE) -C util
67 util/%.$(OBJECT_SUFFIX): util/__all_files__
68 @true;
70 video/$(ALLFILES): forcelook
71 $(MAKE) -C video
73 .PRECIOUS: %.$(OBJECT_SUFFIX) util/%.$(OBJECT_SUFFIX) %.files
75 %.util$(DOT_EXECUTABLE_SUFFIX): %.$(OBJECT_SUFFIX) __all_common__.files
76 $(REALCC) -o $@ $< `cat __all_common__.files` $(LDFLAGS) `cat $(COMMON_LIBRARY_FLAGS)`
78 lsnes$(DOT_EXECUTABLE_SUFFIX): __all_common__.files __all_platform__.files
79 $(REALCC) -o $@ `cat __all_common__.files __all_platform__.files` $(LDFLAGS) `cat $(COMMON_LIBRARY_FLAGS) $(PLATFORM_LIBRARY_FLAGS)`
81 precheck:
82 $(MAKE) -C cmdhelp prebuild
83 $(MAKE) -C core precheck
84 $(MAKE) -C emulation precheck
85 $(MAKE) -C fonts precheck
86 $(MAKE) -C interface precheck
87 $(MAKE) -C library precheck
88 $(MAKE) -C lua precheck
89 $(MAKE) -C platform precheck
90 $(MAKE) -C util precheck
91 $(MAKE) -C video precheck
92 $(MAKE) -C cmdhelp precheck
94 platclean:
95 $(MAKE) -C emulation clean
97 clean:
98 rm -f *.$(OBJECT_SUFFIX) *.ldflags
99 find . -name "*.dep" -exec rm -f {} \;
100 $(MAKE) -C core clean
101 $(MAKE) -C emulation clean
102 $(MAKE) -C fonts clean
103 $(MAKE) -C interface clean
104 $(MAKE) -C library clean
105 $(MAKE) -C lua clean
106 $(MAKE) -C platform clean
107 $(MAKE) -C util clean
108 $(MAKE) -C video clean
109 $(MAKE) -C cmdhelp clean
111 forcelook:
112 @true