10 LIBPNGDIR := libpng-1.2.8
14 LIBOGGDIR := libogg-1.0
15 LIBVORBISDIR := libvorbis-1.0.1
17 EXE := $(RUNDIR)/lugaru-bin
26 OPT := -O3 -fno-strict-aliasing -falign-loops=16 -fno-math-errno
27 #OPT := -Os -fno-strict-aliasing
29 # always use this on the Mac, even in debug builds, since we aren't building
30 # a dylib at this point.
31 ifeq ($(strip $(macosx)),true)
32 OPT += -mdynamic-no-pic
41 -Dstricmp=strcasecmp \
49 ifeq ($(strip $(use_devil)),true)
50 DEFINES += -DUSE_DEVIL=1
51 INCLUDES += -I$(SRCDIR)/devil/include
53 DEFINES += -DZ_PREFIX=1
54 INCLUDES += -I$(ZLIBDIR) -I$(LIBPNGDIR) -I$(JPEGLIBDIR)
57 ifeq ($(strip $(use_fmod)),false)
58 DEFINES += -DUSE_OPENAL=1
59 INCLUDES += -I$(OPENALDIR)/include -I$(LIBOGGDIR)/include -I$(LIBVORBISDIR)/include
63 CFLAGS := -g -c $(OPT) $(INCLUDES) $(DEFINES) -fsigned-char -pipe
66 ifeq ($(strip $(macosx)),true)
67 CFLAGS += -fpascal-strings -faltivec -fasm -force_cpusubtype_ALL -Wno-long-double -mdynamic-no-pic
68 CFLAGS += -DPLATFORM_BIGENDIAN=1 -DMACOSX=1 -DPLATFORM_MACOSX=1
69 LDFLAGS := -framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation -framework Carbon
70 APPLDFLAGS := $(SDLDIR)/lib/libSDL-1.2.0.dylib $(SDLDIR)/lib/libSDLmain-osx.a
72 CFLAGS += -DPLATFORM_LINUX=1
73 LDFLAGS := ./libSDL-1.2.so.0
74 POSTLDFLAGS := /usr/lib/libGLU.a
76 ifeq ($(strip $(use_devil)),true)
77 LDFLAGS += ./libIL.so.1 ./libILU.so.1 ./libILUT.so.1
80 ifeq ($(strip $(use_fmod)),true)
81 POSTLDFLAGS += -lpthread ./libfmod-linux-x86.a
83 LDFLAGS += ./openal.so
113 MacCompatibility.cpp \
119 SRCS := $(foreach f,$(SRCS),$(SRCDIR)/$(f))
146 PNGSRCS := $(foreach f,$(PNGSRCS),$(LIBPNGDIR)/$(f))
195 JPEGSRCS := $(foreach f,$(JPEGSRCS),$(JPEGLIBDIR)/$(f))
212 ZLIBSRCS := $(foreach f,$(ZLIBSRCS),$(ZLIBDIR)/$(f))
218 OGGSRCS := $(foreach f,$(OGGSRCS),$(LIBOGGDIR)/src/$(f))
242 VORBISSRCS := $(foreach f,$(VORBISSRCS),$(LIBVORBISDIR)/lib/$(f))
245 ifeq ($(strip $(use_devil)),false)
246 SRCS += $(PNGSRCS) $(JPEGSRCS) $(ZLIBSRCS)
249 ifeq ($(strip $(use_fmod)),false)
250 SRCS += $(OGGSRCS) $(VORBISSRCS)
253 OBJS := $(SRCS:.CC=.o)
254 OBJS := $(OBJS:.cc=.o)
255 OBJS := $(OBJS:.cpp=.o)
256 OBJS := $(OBJS:.c=.o)
257 OBJS := $(OBJS:.m=.o)
258 OBJS := $(foreach f,$(OBJS),$(BINDIR)/$(f))
265 $(BINDIR)/%.o : %.cpp
266 $(CXX) -o $@ $(CXXFLAGS) $<
269 $(CXX) -x c++ -o $@ $(CXXFLAGS) $<
272 $(CXX) -o $@ $(CXXFLAGS) $<
275 $(CC) -o $@ $(CFLAGS) $<
278 $(CC) -o $@ $(CFLAGS) $<
280 $(EXE) : $(OBJS) $(APPOBJS)
281 ifeq ($(strip $(macosx)),true)
282 ranlib $(SDLDIR)/lib/libSDLmain-osx.a
283 ranlib $(FREETYPEDIR)/lib/libfreetype-osx.a
285 $(LD) -o $@ $(APPLDFLAGS) $(LDFLAGS) $(OBJS) $(APPOBJS) $(POSTLDFLAGS)
289 rm -f $(BINDIR)/$(SRCDIR)/*.o
290 rm -f $(BINDIR)/$(SRCDIR)/logger/*.o
291 rm -f $(BINDIR)/$(LIBPNGDIR)/*.o
292 rm -f $(BINDIR)/$(JPEGLIBDIR)/*.o
293 rm -f $(BINDIR)/$(ZLIBDIR)/*.o
294 rm -f $(BINDIR)/$(LIBOGGDIR)/src/*.o
295 rm -f $(BINDIR)/$(LIBVORBISDIR)/lib/*.o
298 # end of makefile ...