1#
2# Values to be updated if needed...
3#
4
5# The DLL name
6LIB_NAME=glc32
7
8# The FreeType and Fontconfig libraries
9SUBLIBRARIES=-lfreetype -lfontconfig
10
11# OpenGL libraries (those are quite standard and should not need to be changed)
12OPENGL_LIBS=-lopengl32 -lglu32
13
14# The PATH to the include directory of MinGW
15MINGW_INCLUDE=c:\mingw\include
16
17# The PATH to the include directory of FreeType
18FREETYPE_INCLUDE=c:\mingw\include\freetype2
19
20# Some special flags may be needed to compile with GLUT
21# May be -D_STDCALL_SUPPORTED -D_M_IX86 or nothing at all
22GLUT_FLAGS=-DGLUT_DISABLE_ATEXIT_HACK
23
24# The PATH to the GLUT library (may depend on your implementation of GLUT)
25# May be c:\[...]\libglut32.lib
26GLUT_LIBS=c:\mingw\lib\libglut.a
27######################################
28#                                    #
29# No value needs to be changed below #
30#                                    #
31######################################
32
33QUESOGLC_VERSION=0.7.1
34
35C_FILES=context.c database.c except.c font.c global.c master.c measure.c misc.c oarray.c ocharmap.c ocontext.c \
36	  ofacedesc.c ofont.c oglyph.c render.c scalable.c transform.c texture.c unicode.c glew.c omaster.c
37FRIBIDI_FILES=fribidi.c fribidi_char_type.c fribidi_types.c fribidi_mirroring.c
38TESTS=test1 test4 test5 test6 test7 test8 test10 testcontex testfont testmaster testrender
39EXAMPLES=glcdemo glclogo tutorial tutorial2 unicode demo
40
41C_SOURCE=$(addprefix src/,$(C_FILES)) $(addprefix src/fribidi/,$(FRIBIDI_FILES))
42LIB_OBJECTS=$(addprefix build/,$(C_FILES:.c=.o)) $(addprefix build/,$(FRIBIDI_FILES:.c=.o))
43TESTS_OBJECTS=$(addprefix tests/,$(addsuffix .exe, $(TESTS)))
44EXAMPLES_OBJECTS=$(addprefix examples/,$(addsuffix .exe, $(EXAMPLES)))
45GLUT_FLAGS+=-Iinclude
46GLUT_LIBS+=$(OPENGL_LIBS)
47LDFLAGS=-Lbuild
48
49LIBRARY=$(LIB_NAME).dll
50SUBLIBRARIES+=$(OPENGL_LIBS)
51LIBS=$(LDFLAGS) -l$(LIB_NAME)
52CC=gcc
53ifdef DEBUGMODE
54CFLAGS=-g -Wall -Werror -DDEBUGMODE
55else
56CFLAGS=-O2 -fomit-frame-pointer -ffast-math
57endif
58CPPFLAGS=-Iinclude -Isrc -I$(MINGW_INCLUDE) -I$(FREETYPE_INCLUDE)
59
60.PHONY : all
61all: $(TESTS_OBJECTS) $(EXAMPLES_OBJECTS)
62
63.PHONY : clean
64clean:
65	del build\*.o
66	del build\*.a
67	del build\$(LIBRARY)
68	del examples\*.exe
69	del tests\*.exe
70
71tests/%.exe : tests/%.c build/$(LIBRARY)
72	$(CC) $(CFLAGS) $(GLUT_FLAGS) -DGLEW_MX -DQUESOGLC_VERSION=\"$(QUESOGLC_VERSION)\" $< -o $@ $(LIBS) $(GLUT_LIBS)
73
74build/trackball.o : examples/trackball.c
75	$(CC) -c $(CFLAGS) $< -o $@
76
77examples/demo.exe : examples/demo.c build/trackball.o
78	$(CC) $(CFLAGS) $(GLUT_FLAGS) -o $@ $^ $(LIBS) $(GLUT_LIBS)
79
80examples/%.exe : examples/%.c build/$(LIBRARY)
81	$(CC) $(CFLAGS) $(GLUT_FLAGS) $< -o $@ $(LIBS) $(GLUT_LIBS)
82
83build/%.o : src/fribidi/%.c
84	$(CC) -c $(CFLAGS) $(CPPFLAGS) -Isrc/fribidi $< -o $@
85
86build/%.o : src/%.c
87	$(CC) -c $(CFLAGS) -DGLEW_MX -DGLEW_BUILD $(CPPFLAGS) -DQUESOGLC_VERSION=\"$(QUESOGLC_VERSION)\" $< -o $@
88
89build/$(LIBRARY): $(LIB_OBJECTS)
90	$(CC) -shared -o build/$(LIBRARY) -Wl,--output-def,build/$(LIB_NAME).def,--out-implib,build/lib$(LIB_NAME).a $(LIB_OBJECTS) $(SUBLIBRARIES)
91