Merge branch 'rr1-maint'
[lsnes.git] / src / Makefile
bloba8fc64cae2c704d123dd1f416fc75e26e3e7e0b6
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 endif
23 COMMON_LIBRARY=core lua fonts library interface video emulation
24 ALLFILES=__all__.files
25 ALLFLAGS=__all__.ldflags
26 COMMON_LIBRARY_FILES=$(patsubst %,%/$(ALLFILES),$(COMMON_LIBRARY))
27 COMMON_LIBRARY_FLAGS=$(patsubst %,%/$(ALLFLAGS),$(COMMON_LIBRARY))
28 PLATFORM_LIBRARY_FILES=platform/$(ALLFILES)
29 PLATFORM_LIBRARY_FLAGS=platform/$(ALLFLAGS)
31 __all_common__.files: $(COMMON_LIBRARY_FILES)
32 lua genfilelist.lua $^ >$@
34 __all_platform__.files: $(PLATFORM_LIBRARY_FILES)
35 lua genfilelist.lua $^ >$@
37 core/$(ALLFILES): forcelook
38 $(MAKE) -C core
40 emulation/$(ALLFILES): forcelook
41 $(MAKE) -C emulation
43 fonts/$(ALLFILES): forcelook
44 $(MAKE) -C fonts
46 library/$(ALLFILES): forcelook
47 $(MAKE) -C library
49 interface/$(ALLFILES): forcelook
50 $(MAKE) -C interface
52 lua/$(ALLFILES): forcelook
53 $(MAKE) -C lua
55 platform/$(ALLFILES): forcelook
56 $(MAKE) -C platform
58 util/__all_files__: forcelook
59 $(MAKE) -C util
61 util/%.$(OBJECT_SUFFIX): util/__all_files__
62 @true;
64 video/$(ALLFILES): forcelook
65 $(MAKE) -C video
67 .PRECIOUS: %.$(OBJECT_SUFFIX) util/%.$(OBJECT_SUFFIX) %.files
69 %.util$(DOT_EXECUTABLE_SUFFIX): %.$(OBJECT_SUFFIX) __all_common__.files
70 $(REALCC) -o $@ $< `cat __all_common__.files` $(LDFLAGS) `cat $(COMMON_LIBRARY_FLAGS)`
72 lsnes$(DOT_EXECUTABLE_SUFFIX): __all_common__.files __all_platform__.files
73 $(REALCC) -o $@ `cat __all_common__.files __all_platform__.files` $(LDFLAGS) `cat $(COMMON_LIBRARY_FLAGS) $(PLATFORM_LIBRARY_FLAGS)`
75 precheck:
76 $(MAKE) -C core precheck
77 $(MAKE) -C emulation precheck
78 $(MAKE) -C interface precheck
79 $(MAKE) -C library precheck
80 $(MAKE) -C lua precheck
81 $(MAKE) -C platform precheck
82 $(MAKE) -C util precheck
83 $(MAKE) -C video precheck
85 clean:
86 rm -f *.$(OBJECT_SUFFIX) *.ldflags
87 $(MAKE) -C core clean
88 $(MAKE) -C emulation clean
89 $(MAKE) -C fonts clean
90 $(MAKE) -C interface clean
91 $(MAKE) -C library clean
92 $(MAKE) -C lua clean
93 $(MAKE) -C platform clean
94 $(MAKE) -C util clean
95 $(MAKE) -C video clean
97 forcelook:
98 @true