Fix case on file path
[clinton/Virtual-Jaguar-Rx.git] / Makefile
1 # Makefile for Virtual Jaguar
2 #
3 # by James Hammons
4 # (C) 2011 Underground Software
5 #
6 # Note that we control the version information here--uncomment only one set of
7 # echo's from the "prepare" recipe. :-)
8 #
9
10 FIND = find
11
12 ifeq ("$(V)","1")
13 Q :=
14 else
15 Q := @
16 endif
17
18 # Gah
19 OSTYPE := $(shell uname -a)
20
21 # Cygwin hack
22 #QMAKE_DIR := C:/cygwin64/lib/qt5/bin/
23
24 # Should catch both 'darwin' and 'darwin7.0'
25 ifeq "$(findstring Darwin,$(OSTYPE))" "Darwin"
26 QMAKE_EXTRA := -spec macx-g++
27 endif
28
29 # Set basic flags, these can be overridden from the environment
30 CFLAGS = -O2
31 CXXFLAGS = -O2
32
33 # Add CPPFLAGS
34 CFLAGS += $(CPPFLAGS)
35 CXXFLAGS += $(CPPFLAGS)
36
37 # Without these flags, Virtual Jaguar will run very slow.
38 CFLAGS += -ffast-math -fomit-frame-pointer
39 CXXFLAGS += -ffast-math -fomit-frame-pointer
40
41 # Flags to pass on to qmake...
42 QMAKE_EXTRA += "QMAKE_CFLAGS_RELEASE=$(CFLAGS)"
43 QMAKE_EXTRA += "QMAKE_CXXFLAGS_RELEASE=$(CXXFLAGS)"
44 QMAKE_EXTRA += "QMAKE_LFLAGS_RELEASE=$(LDFLAGS)"
45
46 QMAKE_EXTRA += "QMAKE_CFLAGS_DEBUG=$(CFLAGS)"
47 QMAKE_EXTRA += "QMAKE_CXXFLAGS_DEBUG=$(CXXFLAGS)"
48 QMAKE_EXTRA += "QMAKE_LFLAGS_DEBUG=$(LDFLAGS)"
49
50
51 all: prepare virtualjaguar
52 @echo -e "\033[01;33m***\033[00;32m Success!\033[00m"
53
54 obj:
55 @mkdir obj
56
57 prepare: obj
58 @echo -e "\033[01;33m***\033[00;32m Preparing to compile Virtual Jaguar...\033[00m"
59 # @echo "#define VJ_RELEASE_VERSION \"v2.1.3\"" > src/version.h
60 # @echo "#define VJ_RELEASE_SUBVERSION \"Final\"" >> src/version.h
61 # @echo "#define VJ_REMOVE_DEV_CODE" >> src/version.h
62 @echo "#define VJ_RELEASE_VERSION \"GIT `git log -1 --pretty=format:%ci | cut -d ' ' -f 1 | tr -d -`\"" > src/version.h
63 @echo "#define VJ_RELEASE_SUBVERSION \"2.1.3 Prerelease\"" >> src/version.h
64
65 virtualjaguar: sources libs makefile-qt
66 @echo -e "\033[01;33m***\033[00;32m Making Virtual Jaguar GUI...\033[00m"
67 $(Q)$(MAKE) -f makefile-qt CROSS=$(CROSS) V="$(V)"
68
69 makefile-qt: virtualjaguar.pro
70 @echo -e "\033[01;33m***\033[00;32m Creating Qt makefile...\033[00m"
71 $(Q)$(CROSS)$(QMAKE_DIR)qmake $(QMAKE_EXTRA) virtualjaguar.pro -o makefile-qt
72
73 libs: obj/libm68k.a obj/libjaguarcore.a
74 @echo -e "\033[01;33m***\033[00;32m Libraries successfully made.\033[00m"
75
76 obj/libm68k.a: src/m68000/Makefile sources
77 @echo -e "\033[01;33m***\033[00;32m Making Customized UAE 68K Core...\033[00m"
78 $(Q)$(MAKE) -C src/m68000 CROSS=$(CROSS) CFLAGS="$(CFLAGS)" V="$(V)"
79 $(Q)cp src/m68000/obj/libm68k.a obj/
80
81 obj/libjaguarcore.a: jaguarcore.mak sources
82 @echo -e "\033[01;33m***\033[00;32m Making Virtual Jaguar core...\033[00m"
83 $(Q)$(MAKE) -f jaguarcore.mak CROSS=$(CROSS) CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" V="$(V)"
84
85 sources: src/*.h src/*.cpp src/m68000/*.c src/m68000/*.h
86
87 clean:
88 @echo -ne "\033[01;33m***\033[00;32m Cleaning out the garbage...\033[00m"
89 @-rm -rf ./obj
90 @-rm -rf ./src/m68000/obj
91 @-rm -rf makefile-qt
92 @-rm -rf virtualjaguar
93 @-$(FIND) . -name "*~" -exec rm -f {} \;
94 @echo "done!"
95
96 statistics:
97 @echo -n "Lines in source files: "
98 @-$(FIND) ./src -name "*.cpp" | xargs cat | wc -l
99 @echo -n "Lines in header files: "
100 @-$(FIND) ./src -name "*.h" | xargs cat | wc -l
101
102 dist: clean