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