author | Ryan C. Gordon <icculus@icculus.org> |
Fri, 06 Jul 2001 21:29:37 +0000 | |
changeset 12 | a4041c91d715 |
parent 11 | 677e01f5109e |
child 13 | 4f98eb8bbabb |
permissions | -rw-r--r-- |
9 | 1 |
#-----------------------------------------------------------------------------# |
2 |
# PhysicsFS -- A filesystem abstraction. |
|
3 |
# |
|
4 |
# Please see the file LICENSE in the source's root directory. |
|
5 |
# This file written by Ryan C. Gordon. |
|
6 |
#-----------------------------------------------------------------------------# |
|
7 |
||
8 |
||
9 |
#-----------------------------------------------------------------------------# |
|
10 |
# Makefile for building PhysicsFS on Unix-like systems. Follow the |
|
11 |
# instructions for editing this file, then run "make" on the command line. |
|
12 |
#-----------------------------------------------------------------------------# |
|
13 |
||
14 |
||
15 |
#-----------------------------------------------------------------------------# |
|
16 |
# Set to your liking. |
|
17 |
#-----------------------------------------------------------------------------# |
|
18 |
CC = gcc |
|
19 |
LINKER = gcc |
|
20 |
||
21 |
||
22 |
#-----------------------------------------------------------------------------# |
|
23 |
# If this makefile fails to detect Cygwin correctly, or you want to force |
|
24 |
# the build process's behaviour, set it to "true" or "false" (w/o quotes). |
|
25 |
#-----------------------------------------------------------------------------# |
|
26 |
#cygwin := true |
|
27 |
#cygwin := false |
|
28 |
cygwin := autodetect |
|
29 |
||
30 |
#-----------------------------------------------------------------------------# |
|
31 |
# Set this to true if you want to create a debug build. |
|
32 |
#-----------------------------------------------------------------------------# |
|
33 |
#debugging := false |
|
34 |
debugging := true |
|
35 |
||
36 |
#-----------------------------------------------------------------------------# |
|
37 |
# Set the archive types you'd like to support. |
|
38 |
# Note that various archives may need external libraries. |
|
39 |
#-----------------------------------------------------------------------------# |
|
40 |
use_archive_zip := false |
|
41 |
||
42 |
#-----------------------------------------------------------------------------# |
|
43 |
# Set to "true" if you'd like to build a DLL. Set to "false" otherwise. |
|
44 |
#-----------------------------------------------------------------------------# |
|
45 |
#build_dll := false |
|
46 |
build_dll := true |
|
47 |
||
48 |
||
49 |
#-----------------------------------------------------------------------------# |
|
50 |
# Set one of the below. Currently, none of these are used. |
|
51 |
#-----------------------------------------------------------------------------# |
|
52 |
#use_asm = -DUSE_I386_ASM |
|
53 |
use_asm = -DUSE_PORTABLE_C |
|
54 |
||
55 |
||
56 |
#-----------------------------------------------------------------------------# |
|
57 |
#-----------------------------------------------------------------------------# |
|
58 |
#-----------------------------------------------------------------------------# |
|
59 |
#-----------------------------------------------------------------------------# |
|
60 |
# Everything below this line is probably okay. |
|
61 |
#-----------------------------------------------------------------------------# |
|
62 |
#-----------------------------------------------------------------------------# |
|
63 |
#-----------------------------------------------------------------------------# |
|
64 |
#-----------------------------------------------------------------------------# |
|
65 |
||
66 |
||
67 |
#-----------------------------------------------------------------------------# |
|
68 |
# CygWin autodetect. |
|
69 |
#-----------------------------------------------------------------------------# |
|
70 |
||
71 |
ifeq ($(strip $(cygwin)),autodetect) |
|
72 |
ifneq ($(strip $(shell gcc -v 2>&1 |grep "cygwin")),) |
|
73 |
cygwin := true |
|
74 |
else |
|
75 |
cygwin := false |
|
76 |
endif |
|
77 |
endif |
|
78 |
||
79 |
||
80 |
#-----------------------------------------------------------------------------# |
|
81 |
# Platform-specific binary stuff. |
|
82 |
#-----------------------------------------------------------------------------# |
|
83 |
||
84 |
ifeq ($(strip $(cygwin)),true) |
|
85 |
# !!! FIXME |
|
86 |
build_dll := false |
|
87 |
# !!! FIXME |
|
88 |
||
89 |
ASM = nasmw |
|
90 |
EXE_EXT = .exe |
|
91 |
DLL_EXT = .dll |
|
92 |
STATICLIB_EXT = .a |
|
93 |
ASMOBJFMT = win32 |
|
94 |
ASMDEFS = -dC_IDENTIFIERS_UNDERSCORED |
|
95 |
CFLAGS += -DC_IDENTIFIERS_UNDERSCORED |
|
96 |
else |
|
97 |
ASM = nasm |
|
98 |
EXE_EXT = |
|
99 |
DLL_EXT = .so |
|
100 |
STATICLIB_EXT = .a |
|
101 |
ASMOBJFMT = elf |
|
102 |
endif |
|
103 |
||
104 |
ifeq ($(strip $(build_dll)),true) |
|
105 |
LIB_EXT := $(DLL_EXT) |
|
106 |
LDFLAGS += -shared |
|
107 |
else |
|
108 |
LIB_EXT := $(STATICLIB_EXT) |
|
109 |
endif |
|
110 |
||
111 |
#-----------------------------------------------------------------------------# |
|
112 |
# General compiler, assembler, and linker flags. |
|
113 |
#-----------------------------------------------------------------------------# |
|
114 |
||
115 |
BINDIR := bin |
|
116 |
SRCDIR := . |
|
117 |
||
118 |
CFLAGS += $(use_asm) -I$(SRCDIR) -D_REENTRANT -fsigned-char -DPLATFORM_UNIX |
|
119 |
CFLAGS += -Wall -Werror -fno-exceptions -fno-rtti -ansi -pendantic |
|
120 |
||
121 |
LDFLAGS += -lm |
|
122 |
||
123 |
ifeq ($(strip $(debugging)),true) |
|
124 |
CFLAGS += -DDEBUG -g -fno-omit-frame-pointer |
|
125 |
LDFLAGS += -g -fno-omit-frame-pointer |
|
126 |
else |
|
127 |
CFLAGS += -DNDEBUG -O2 -fomit-frame-pointer |
|
128 |
LDFLAGS += -O2 -fomit-frame-pointer |
|
129 |
endif |
|
130 |
||
131 |
ASMFLAGS := -f $(ASMOBJFMT) $(ASMDEFS) |
|
132 |
||
133 |
||
134 |
#-----------------------------------------------------------------------------# |
|
135 |
# Source and target names. |
|
136 |
#-----------------------------------------------------------------------------# |
|
137 |
||
138 |
BASELIBNAME := physfs |
|
139 |
MAINLIB := $(BINDIR)/$(strip $(BASELIBNAME))$(strip $(LIB_EXT)) |
|
140 |
||
141 |
MAINSRCS := physfs.c unix.c dir.c |
|
142 |
||
143 |
ifeq ($(strip $(use_archive_zip)),true) |
|
144 |
MAINSRCS += zip.c |
|
145 |
CFLAGS += -DPHYSFS_SUPPORTS_ZIP |
|
146 |
endif |
|
147 |
||
148 |
# Rule for getting list of objects from source |
|
149 |
MAINOBJS1 := $(MAINSRCS:.c=.o) |
|
150 |
MAINOBJS2 := $(MAINOBJS1:.cpp=.o) |
|
151 |
MAINOBJS3 := $(MAINOBJS2:.asm=.o) |
|
152 |
||
153 |
MAINOBJS := $(foreach f,$(MAINOBJS3),$(BINDIR)/$(f)) |
|
154 |
MAINSRCS := $(foreach f,$(MAINSRCS),$(SRCDIR)/$(f)) |
|
155 |
||
156 |
CLEANUP = $(wildcard *.exe) $(wildcard *.obj) \ |
|
157 |
$(wildcard $(BINDIR)/*.exe) $(wildcard $(BINDIR)/*.obj) \ |
|
158 |
$(wildcard *~) $(wildcard *.err) \ |
|
159 |
$(wildcard .\#*) core |
|
160 |
||
161 |
||
162 |
#-----------------------------------------------------------------------------# |
|
163 |
# Rules. |
|
164 |
#-----------------------------------------------------------------------------# |
|
165 |
||
166 |
# Rules for turning source files into .o files |
|
167 |
$(BINDIR)/%.o: $(SRCDIR)/%.cpp |
|
168 |
$(CC) -c -o $@ $< $(CFLAGS) |
|
169 |
||
170 |
$(BINDIR)/%.o: $(SRCDIR)/%.c |
|
171 |
$(CC) -c -o $@ $< $(CFLAGS) |
|
172 |
||
173 |
$(BINDIR)/%.o: $(SRCDIR)/%.asm |
|
174 |
$(ASM) $(ASMFLAGS) -o $@ $< |
|
175 |
||
11
677e01f5109e
Progress toward complete implementation continues...
Ryan C. Gordon <icculus@icculus.org>
parents:
9
diff
changeset
|
176 |
.PHONY: all clean distclean listobjs |
9 | 177 |
|
178 |
all: $(BINDIR) $(MAINLIB) |
|
179 |
||
180 |
$(MAINLIB) : $(BINDIR) $(MAINOBJS) |
|
181 |
$(LINKER) -o $(MAINLIB) $(LDFLAGS) $(MAINOBJS) |
|
182 |
||
183 |
$(BINDIR): |
|
184 |
mkdir -p $(BINDIR) |
|
185 |
||
11
677e01f5109e
Progress toward complete implementation continues...
Ryan C. Gordon <icculus@icculus.org>
parents:
9
diff
changeset
|
186 |
distclean: clean |
677e01f5109e
Progress toward complete implementation continues...
Ryan C. Gordon <icculus@icculus.org>
parents:
9
diff
changeset
|
187 |
|
9 | 188 |
clean: |
189 |
rm -f $(CLEANUP) |
|
190 |
rm -rf $(BINDIR) |
|
191 |
||
192 |
listobjs: |
|
193 |
@echo SOURCES: |
|
194 |
@echo $(MAINSRCS) |
|
195 |
@echo |
|
196 |
@echo OBJECTS: |
|
197 |
@echo $(MAINOBJS) |
|
198 |
@echo |
|
199 |
@echo BINARIES: |
|
200 |
@echo $(MAINLIB) |
|
201 |
||
202 |
showcfg: |
|
203 |
@echo "Using CygWin : $(cygwin)" |
|
204 |
@echo "Debugging : $(debugging)" |
|
205 |
@echo "ASM flag : $(use_asm)" |
|
206 |
@echo "Building DLLs : $(build_dll)" |
|
207 |
@echo "Supports .ZIP : $(use_archive_zip)" |
|
208 |
||
209 |
#-----------------------------------------------------------------------------# |
|
210 |
# This section is pretty much just for Ryan's use to make distributions. |
|
211 |
# You Probably Should Not Touch. |
|
212 |
#-----------------------------------------------------------------------------# |
|
213 |
||
214 |
# These are the files needed in a binary distribution, regardless of what |
|
215 |
# platform is being used. |
|
216 |
BINSCOMMON := LICENSE.TXT physfs.h |
|
217 |
||
218 |
.PHONY: package msbins win32bins nocygwin |
|
219 |
package: clean |
|
220 |
cd .. ; zip -9rz ./physfs-src-$(shell date +%m%d%Y).zip physfs -x "*CVS*" < physfs/FILEID.DIZ |
|
221 |
||
222 |
||
223 |
ifeq ($(strip $(cygwin)),true) |
|
224 |
msbins: win32bins |
|
225 |
||
226 |
win32bins: clean all |
|
227 |
echo -e "\r\n\r\n\r\nHEY YOU.\r\n\r\n\r\nTake a look at README-win32bins.txt FIRST.\r\n\r\n\r\n--ryan. (icculus@linuxgames.com)\r\n\r\n" |zip -9rz ../physfs-win32bins-$(shell date +%m%d%Y).zip $(MAINLIB) $(EXTRAPACKAGELIBS) README-win32bins.txt |
|
228 |
||
229 |
else |
|
230 |
||
231 |
msbins: nocygwin |
|
232 |
win32bins: nocygwin |
|
233 |
||
234 |
nocygwin: |
|
235 |
@echo This must be done on a Windows box in the Cygwin environment. |
|
236 |
||
237 |
endif |
|
238 |
||
239 |
#-----------------------------------------------------------------------------# |
|
240 |
# That's all, folks. |
|
241 |
#-----------------------------------------------------------------------------# |
|
242 |
||
243 |
# end of Makefile ... |