Fix case on file path
[clinton/Virtual-Jaguar-Rx.git] / Makefile
CommitLineData
cf76e892
JPM
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
10FIND = find
11
12ifeq ("$(V)","1")
13Q :=
14else
15Q := @
16endif
17
18# Gah
19OSTYPE := $(shell uname -a)
20
21# Cygwin hack
22#QMAKE_DIR := C:/cygwin64/lib/qt5/bin/
23
24# Should catch both 'darwin' and 'darwin7.0'
25ifeq "$(findstring Darwin,$(OSTYPE))" "Darwin"
26QMAKE_EXTRA := -spec macx-g++
27endif
28
29# Set basic flags, these can be overridden from the environment
30CFLAGS = -O2
31CXXFLAGS = -O2
32
33# Add CPPFLAGS
34CFLAGS += $(CPPFLAGS)
35CXXFLAGS += $(CPPFLAGS)
36
37# Without these flags, Virtual Jaguar will run very slow.
38CFLAGS += -ffast-math -fomit-frame-pointer
39CXXFLAGS += -ffast-math -fomit-frame-pointer
40
41# Flags to pass on to qmake...
42QMAKE_EXTRA += "QMAKE_CFLAGS_RELEASE=$(CFLAGS)"
43QMAKE_EXTRA += "QMAKE_CXXFLAGS_RELEASE=$(CXXFLAGS)"
44QMAKE_EXTRA += "QMAKE_LFLAGS_RELEASE=$(LDFLAGS)"
45
46QMAKE_EXTRA += "QMAKE_CFLAGS_DEBUG=$(CFLAGS)"
47QMAKE_EXTRA += "QMAKE_CXXFLAGS_DEBUG=$(CXXFLAGS)"
48QMAKE_EXTRA += "QMAKE_LFLAGS_DEBUG=$(LDFLAGS)"
49
50
51all: prepare virtualjaguar
52 @echo -e "\033[01;33m***\033[00;32m Success!\033[00m"
53
54obj:
55 @mkdir obj
56
57prepare: 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
65virtualjaguar: 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
69makefile-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
73libs: obj/libm68k.a obj/libjaguarcore.a
74 @echo -e "\033[01;33m***\033[00;32m Libraries successfully made.\033[00m"
75
76obj/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
81obj/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
85sources: src/*.h src/*.cpp src/m68000/*.c src/m68000/*.h
86
87clean:
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
96statistics:
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
102dist: clean