Repository navigation
Expand file tree
/
Copy pathMakefile.vc
More file actions
160 lines (128 loc) · 3.92 KB
/
Copy pathMakefile.vc
File metadata and controls
160 lines (128 loc) · 3.92 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# -*- Makefile -*-
#
#
# Copyright (C) 2006 Pat Thoyts <patthoyts@users.sourceforge.net>
#
#-------------------------------------------------------------------------
# $Id$
#-------------------------------------------------------------------------
VERSION=0.4
# You should set SDLDIR to the directory containing your SDL include
# and lib directories.
!ifndef SDLDIR
SDLDIR =/opt
!endif
#-------------------------------------------------------------------------
# There should be no need to edit below this point.
#-------------------------------------------------------------------------
SRCDIR =src
!ifndef DEBUG
DEBUG =0
!endif
!ifndef PROFILE
PROFILE =0
!endif
!ifndef SYMBOLS
SYMBOLS = 0
!endif
!ifndef CC
CC=cl
!endif
!ifndef LINK
LINK=link
!endif
!if $(DEBUG)
OUTDIR =Debug
CFLAGS =-Od -Zi -GZ -MDd -D_DEBUG -DDEBUG
LDFLAGS=-debug:full -debugtype:cv
!else
OUTDIR =Release
!if $(SYMBOLS)
CFLAGS =-Od -Zi -Op -Gs -MD -DNDEBUG
LDFLAGS=-debug -opt:ref -opt:icf,3
!else
CFLAGS =-O2 -Otip -Gs -MD -DNDEBUG
LDFLAGS=-release -opt:ref -opt:icf,3
!endif
!endif
!if $(PROFILE)
CFLAGS =$(CFLAGS) -Zi
LDFLAGS=$(LDFLAGS) -profile -map
!endif
!if "$(OS)" == "Windows_NT"
RMDIR = rmdir /s /q >NUL
!else
RMDIR = deltree /y
!endif
DEL = del /f /q
CP = copy /y >NUL
MAKENSIS = "C:\Program Files (x86)\NSIS\makensis.exe"
TMPDIR =$(OUTDIR)\Objects
TSTDIR =$(OUTDIR)\TestObjects
CC =$(CC) -nologo
LD =$(LINK) -nologo
CFLAGS =$(CFLAGS) -W3 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
INC =-I$(SDLDIR)/include
DEFS =-DWIN32 -DHAVE_OPENGL -Dmain=SDL_main
LIBS =-libpath:$(SDLDIR)/lib SDLmain.lib SDL.lib SDL_mixer.lib user32.lib kernel32.lib
LDFLAGS=$(LDFLAGS) -subsystem:windows
OBJS = \
$(TMPDIR)\ag.obj \
$(TMPDIR)\ag_core.obj \
$(TMPDIR)\dlb.obj \
$(TMPDIR)\linked.obj \
$(TMPDIR)\sprite.obj \
$(TMPDIR)\ag.res
all: ag
ag: setup $(OUTDIR)\ag.exe
$(OUTDIR)\ag.exe: $(OBJS)
$(LD) $(LDFLAGS) -out:$@ $** $(LIBS)
release: ag Anagramarama.nsi
@$(CP) $(SDLDIR:/=\)\bin\sdl.dll $(OUTDIR)\SDL.dll
@$(CP) $(SDLDIR:/=\)\bin\SDL_mixer.dll $(OUTDIR)\SDL_mixer.dll
@$(MAKENSIS) /V2 Anagramarama.nsi
@echo Installer file created
.PHONY: all ag release
#-------------------------------------------------------------------------
tests: test_agcore test_dlb test_linked
test_ag: setup $(OUTDIR)\test_ag.exe
test_dlb: setup $(OUTDIR)\test_dlb.exe
test_agcore: setup $(OUTDIR)\test_agcore.exe
test_linked: setup $(OUTDIR)\test_linked.exe
$(OUTDIR)\test_ag.exe: $(SRCDIR)/ag_test.c
$(CC) $(CFLAGS) $(INC) -DUNIT_TEST -Fo$(TSTDIR)\ $** -link $(LDFLAGS) -subsystem:console -out:$@
$(OUTDIR)\test_agcore.exe: $(SRCDIR)/ag_core.c $(TMPDIR)\dlb.obj $(TMPDIR)\linked.obj
$(CC) $(CFLAGS) $(INC) -DUNIT_TEST -Fo$(TSTDIR)\ $** -link $(LDFLAGS) -subsystem:console -out:$@
$(OUTDIR)\test_linked.exe: $(SRCDIR)/linked.c
$(CC) $(CFLAGS) $(INC) -DUNIT_TEST -Fo$(TSTDIR)\ $** -link $(LDFLAGS) -subsystem:console -out:$@
$(OUTDIR)\test_dlb.exe: $(SRCDIR)/dlb.c
$(CC) $(CFLAGS) $(INC) -DUNIT_TEST -Fo$(TSTDIR)\ $** -link $(LDFLAGS) -subsystem:console -out:$@
#-------------------------------------------------------------------------
setup:
@if not exist $(OUTDIR) mkdir $(OUTDIR)
@if not exist $(TMPDIR) mkdir $(TMPDIR)
@if not exist $(TSTDIR) mkdir $(TSTDIR)
clean:
@if exist $(TMPDIR)\NUL $(RMDIR) $(TMPDIR) >NUL
realclean: clean
@if exist $(OUTDIR)\NUL $(RMDIR) $(OUTDIR) >NUL
.PHONY: setup clean realclean
#-------------------------------------------------------------------------
.SUFFIXES:.c .cpp .rc
{$(SRCDIR)}.c{$(TMPDIR)}.obj::
$(CC) $(CFLAGS) $(DEFS) $(INC) -Fo$(TMPDIR)\ -c @<<
$<
<<
{$(SRCDIR)}.cpp{$(TMPDIR)}.obj::
$(CC) $(CFLAGS) $(DEFS) $(INC) -Fo$(TMPDIR)\ -c @<<
$<
<<
{$(SRCDIR)}.rc{$(TMPDIR)}.res:
$(RC) -fo $@ -r -D__WIN32__ \
-DCOMMAVERSION=$(VERSION:.=,),0,0 \
-DVERSION=\"$(VERSION)\" \
!if $(DEBUG)
-d DEBUG \
!endif
$<
#-------------------------------------------------------------------------