1###########################################################################
2# GLFW top level Makefile
3#
4# This file works as a top level makefile for all supported systems and
5# compilers. It builds both the GLFW link library and the supplied example
6# programs.
7###########################################################################
8
9###########################################################################
10# If your make program does not set the $(MAKE) variable correctly,
11# uncomment the following line and make sure that the name of the make
12# tool is correct.
13###########################################################################
14# MAKE = make
15
16
17###########################################################################
18# If no system/compiler is specified, display a list of available options
19###########################################################################
20default:
21	@echo "This is the root makefile for the GLFW library."
22	@echo ""
23	@echo "Use one of the following commands:"
24	@echo "-----------------------------------------------------------------------------"
25	@echo "  $(MAKE) win32-mingw        to compile for Windows using MinGW"
26	@echo "  $(MAKE) mingw-clean        to remove any files generated for this target"
27	@echo "-----------------------------------------------------------------------------"
28	@echo "  $(MAKE) win32-msys         to compile for Windows using MinGW and MSYS"
29	@echo "  $(MAKE) msys-clean         to remove any files generated for this target"
30	@echo "  $(MAKE) msys-install       to install the GLFW header and static library"
31	@echo "-----------------------------------------------------------------------------"
32	@echo "  $(MAKE) win32-lcc          to compile for Windows using LCC-Win32"
33	@echo "  $(MAKE) win32-ow           to compile for Windows using OpenWatcom"
34	@echo "  $(MAKE) win32-clean        to remove any files generated for this target"
35	@echo "-----------------------------------------------------------------------------"
36	@echo "  $(MAKE) cross-mgw          to compile for Windows using MinGW on Unix"
37	@echo "  $(MAKE) cross-mgw-clean    to remove any files generated for this target"
38	@echo "  $(MAKE) cross-mgw-install  to install the GLFW library and header"
39	@echo "-----------------------------------------------------------------------------"
40	@echo "  $(MAKE) x11                to compile for X11 on Unix-like systems"
41	@echo "  $(MAKE) x11-clean          to remove any files generated for this target"
42	@echo "  $(MAKE) x11-dist-clean     to also removed the configuration files"
43	@echo "  $(MAKE) x11-install        to install the GLFW header and static library"
44	@echo "  $(MAKE) x11-dist-install   to also install the GLFW shared library"
45	@echo "-----------------------------------------------------------------------------"
46	@echo "  $(MAKE) cocoa              to compile GLFW for Cocoa on Mac OS X"
47	@echo "  $(MAKE) cocoa-clean        to remove any files generated for this target"
48	@echo "  $(MAKE) cocoa-install      to install the GLFW header and static library"
49	@echo "  $(MAKE) cocoa-dist-install to also install the GLFW dynamic library"
50	@echo "-----------------------------------------------------------------------------"
51	@echo " There are also Microsoft Visual C++ 2008, 2010 and 2012 project files "
52	@echo " available in the support/msvc* and directories."
53	@echo "-----------------------------------------------------------------------------"
54
55
56###########################################################################
57# Bare MinGW on Windows
58###########################################################################
59
60win32-mingw:
61	@cmd /c compile.bat $(MAKE) mingw
62
63mingw-clean:
64	@cmd /c compile.bat CLEAN
65
66
67###########################################################################
68# Cygwin on Windows
69###########################################################################
70
71CYGWIN=PREFIX=/bin TARGET=i686-pc-mingw32-
72
73cygwin-install: win32-cygwin
74	cd lib/win32 && env $(CYGWIN) $(MAKE) -f Makefile.win32.cross-mgw install
75
76win32-cygwin:
77	cd lib/win32 && env $(CYGWIN) $(MAKE) -f Makefile.win32.cross-mgw
78	cd examples  && env $(CYGWIN) $(MAKE) -f Makefile.win32.cross-mgw
79	cd tests     && env $(CYGWIN) $(MAKE) -f Makefile.win32.cross-mgw
80
81cygwin-clean:
82	cd lib/win32 && env $(CYGWIN) $(MAKE) -f Makefile.win32.cross-mgw clean
83	cd examples  && env $(CYGWIN) $(MAKE) -f Makefile.win32.cross-mgw clean
84	cd tests     && env $(CYGWIN) $(MAKE) -f Makefile.win32.cross-mgw clean
85
86
87###########################################################################
88# MSYS on Windows
89###########################################################################
90
91msys-install: win32-msys
92	cd lib/win32 && $(MAKE) -f Makefile.win32.msys install
93
94win32-msys:
95	cd lib/win32 && $(MAKE) -f Makefile.win32.msys
96	cd examples  && $(MAKE) -f Makefile.win32.msys
97	cd tests     && $(MAKE) -f Makefile.win32.msys
98
99msys-clean:
100	cd lib/win32 && $(MAKE) -f Makefile.win32.msys clean
101	cd examples  && $(MAKE) -f Makefile.win32.msys clean
102	cd tests     && $(MAKE) -f Makefile.win32.msys clean
103
104
105###########################################################################
106# Various compilers on Windows
107###########################################################################
108
109# Windows, LCC-Win32
110win32-lcc:
111	@.\\compile.bat $(MAKE) lcc
112
113# Windows, OpenWatcom
114win32-ow:
115	@.\\compile.bat $(MAKE) ow
116
117# Cleanup for Windows
118win32-clean:
119	@.\\compile.bat CLEAN
120
121
122###########################################################################
123# MinGW cross-compile to Windows from Unix
124###########################################################################
125
126cross-mgw-install: cross-mgw
127	cd lib/win32 && $(MAKE) -f Makefile.win32.cross-mgw install
128
129cross-mgw:
130	cd lib/win32 && $(MAKE) -f Makefile.win32.cross-mgw
131	cd examples  && $(MAKE) -f Makefile.win32.cross-mgw
132	cd tests     && $(MAKE) -f Makefile.win32.cross-mgw
133
134cross-mgw-clean:
135	cd lib/win32 && $(MAKE) -f Makefile.win32.cross-mgw clean
136	cd examples  && $(MAKE) -f Makefile.win32.cross-mgw clean
137	cd tests     && $(MAKE) -f Makefile.win32.cross-mgw clean
138
139
140###########################################################################
141# X11 on Unix-like systems
142###########################################################################
143
144MAKEFILES_X11_IN = lib/x11/Makefile.x11.in examples/Makefile.x11.in \
145		   tests/Makefile.x11.in
146
147MAKEFILES_X11 = lib/x11/Makefile.x11 examples/Makefile.x11 tests/Makefile.x11
148
149# Cleanup for X11 (must be here due to generated makefile)
150x11-clean: $(MAKEFILES_X11)
151	cd lib/x11  && $(MAKE) -f Makefile.x11 clean
152	cd examples && $(MAKE) -f Makefile.x11 clean
153	cd tests    && $(MAKE) -f Makefile.x11 clean
154
155x11-dist-clean: x11-clean
156	rm -f config.log
157	rm -f $(MAKEFILES_X11)
158	rm -f lib/x11/libglfw.pc.in
159
160# Auto configuration for X11
161$(MAKEFILES_X11) : compile.sh $(MAKEFILES_X11_IN)
162	@sh ./compile.sh
163
164# X11
165x11: $(MAKEFILES_X11)
166	cd lib/x11  && $(MAKE) -f Makefile.x11
167	cd examples && $(MAKE) -f Makefile.x11
168	cd tests    && $(MAKE) -f Makefile.x11
169
170# X11 install
171x11-install: x11
172	cd lib/x11 && $(MAKE) -f Makefile.x11 install
173
174# X11 dist install
175x11-dist-install: x11
176	cd lib/x11 && $(MAKE) -f Makefile.x11 dist-install
177
178
179###########################################################################
180# Cocoa on Mac OS X
181###########################################################################
182
183cocoa:
184	cd lib/cocoa && $(MAKE) -f Makefile.cocoa
185	cd examples  && $(MAKE) -f Makefile.cocoa
186	cd tests     && $(MAKE) -f Makefile.cocoa
187
188cocoa-clean:
189	cd lib/cocoa && $(MAKE) -f Makefile.cocoa clean
190	cd examples  && $(MAKE) -f Makefile.cocoa clean
191	cd tests     && $(MAKE) -f Makefile.cocoa clean
192
193cocoa-install: cocoa
194	cd lib/cocoa && $(MAKE) -f Makefile.cocoa install
195
196cocoa-dist-install: cocoa
197	cd lib/cocoa && $(MAKE) -f Makefile.cocoa dist-install
198
199