1VERSION_MAJOR = 1 2VERSION_MINOR = 8 3VERSION_RELEASE = 5 4# Irrlicht Engine 1.8.5 5# Makefile for Linux 6# 7# To use, just run: 8# 9# make 10# 11# This will compile Irrlicht, create a static lib (libIrrlicht.a), and copy it 12# into the subdirectory lib/Linux. That's all. 13# 14# If you want Irrlicht to be compiled as shared lib (libIrrlicht.so.versionnumber), then run: 15# 16# make sharedlib 17# make install 18# 19# If you want to compile in release mode run: 20# 21# make NDEBUG=1 22# 23# For cross-compilation for Win32 under Linux, just use the win32 targets. You have to set 24# at least CXX, CC, and AR to the proper binaries. 25# 26# For compiling on MinGW you can run it with: 27# 28# make win32 29# 30# Or as MinGW by default has CC set to cc - but has no compiler by that name - you might have to do: 31# make CC=gcc win32 32 33#List of object files, separated based on engine architecture 34IRRMESHLOADER = CBSPMeshFileLoader.o CMD2MeshFileLoader.o CMD3MeshFileLoader.o CMS3DMeshFileLoader.o CB3DMeshFileLoader.o C3DSMeshFileLoader.o COgreMeshFileLoader.o COBJMeshFileLoader.o CColladaFileLoader.o CCSMLoader.o CDMFLoader.o CLMTSMeshFileLoader.o CMY3DMeshFileLoader.o COCTLoader.o CXMeshFileLoader.o CIrrMeshFileLoader.o CSTLMeshFileLoader.o CLWOMeshFileLoader.o CPLYMeshFileLoader.o CSMFMeshFileLoader.o 35IRRMESHWRITER = CColladaMeshWriter.o CIrrMeshWriter.o CSTLMeshWriter.o COBJMeshWriter.o CPLYMeshWriter.o 36IRRMESHOBJ = $(IRRMESHLOADER) $(IRRMESHWRITER) \ 37 CSkinnedMesh.o CBoneSceneNode.o CMeshSceneNode.o \ 38 CAnimatedMeshSceneNode.o CAnimatedMeshMD2.o CAnimatedMeshMD3.o \ 39 CQ3LevelMesh.o CQuake3ShaderSceneNode.o CAnimatedMeshHalfLife.o 40IRROBJ = CBillboardSceneNode.o CCameraSceneNode.o CDummyTransformationSceneNode.o CEmptySceneNode.o CGeometryCreator.o CLightSceneNode.o CMeshManipulator.o CMetaTriangleSelector.o COctreeSceneNode.o COctreeTriangleSelector.o CSceneCollisionManager.o CSceneManager.o CShadowVolumeSceneNode.o CSkyBoxSceneNode.o CSkyDomeSceneNode.o CTerrainSceneNode.o CTerrainTriangleSelector.o CVolumeLightSceneNode.o CCubeSceneNode.o CSphereSceneNode.o CTextSceneNode.o CTriangleBBSelector.o CTriangleSelector.o CWaterSurfaceSceneNode.o CMeshCache.o CDefaultSceneNodeAnimatorFactory.o CDefaultSceneNodeFactory.o CSceneLoaderIrr.o 41IRRPARTICLEOBJ = CParticleAnimatedMeshSceneNodeEmitter.o CParticleBoxEmitter.o CParticleCylinderEmitter.o CParticleMeshEmitter.o CParticlePointEmitter.o CParticleRingEmitter.o CParticleSphereEmitter.o CParticleAttractionAffector.o CParticleFadeOutAffector.o CParticleGravityAffector.o CParticleRotationAffector.o CParticleSystemSceneNode.o CParticleScaleAffector.o 42IRRANIMOBJ = CSceneNodeAnimatorCameraFPS.o CSceneNodeAnimatorCameraMaya.o CSceneNodeAnimatorCollisionResponse.o CSceneNodeAnimatorDelete.o CSceneNodeAnimatorFlyCircle.o CSceneNodeAnimatorFlyStraight.o CSceneNodeAnimatorFollowSpline.o CSceneNodeAnimatorRotation.o CSceneNodeAnimatorTexture.o 43IRRDRVROBJ = CNullDriver.o COpenGLDriver.o COpenGLNormalMapRenderer.o COpenGLParallaxMapRenderer.o COpenGLShaderMaterialRenderer.o COpenGLTexture.o COpenGLSLMaterialRenderer.o COpenGLExtensionHandler.o CD3D8Driver.o CD3D8NormalMapRenderer.o CD3D8ParallaxMapRenderer.o CD3D8ShaderMaterialRenderer.o CD3D8Texture.o CD3D9Driver.o CD3D9HLSLMaterialRenderer.o CD3D9NormalMapRenderer.o CD3D9ParallaxMapRenderer.o CD3D9ShaderMaterialRenderer.o CD3D9Texture.o 44IRRIMAGEOBJ = CColorConverter.o CImage.o CImageLoaderBMP.o CImageLoaderDDS.o CImageLoaderJPG.o CImageLoaderPCX.o CImageLoaderPNG.o CImageLoaderPSD.o CImageLoaderTGA.o CImageLoaderPPM.o CImageLoaderWAL.o CImageLoaderRGB.o \ 45 CImageWriterBMP.o CImageWriterJPG.o CImageWriterPCX.o CImageWriterPNG.o CImageWriterPPM.o CImageWriterPSD.o CImageWriterTGA.o 46IRRVIDEOOBJ = CVideoModeList.o CFPSCounter.o $(IRRDRVROBJ) $(IRRIMAGEOBJ) 47IRRSWRENDEROBJ = CSoftwareDriver.o CSoftwareTexture.o CTRFlat.o CTRFlatWire.o CTRGouraud.o CTRGouraudWire.o CTRNormalMap.o CTRStencilShadow.o CTRTextureFlat.o CTRTextureFlatWire.o CTRTextureGouraud.o CTRTextureGouraudAdd.o CTRTextureGouraudNoZ.o CTRTextureGouraudWire.o CZBuffer.o CTRTextureGouraudVertexAlpha2.o CTRTextureGouraudNoZ2.o CTRTextureLightMap2_M2.o CTRTextureLightMap2_M4.o CTRTextureLightMap2_M1.o CSoftwareDriver2.o CSoftwareTexture2.o CTRTextureGouraud2.o CTRGouraud2.o CTRGouraudAlpha2.o CTRGouraudAlphaNoZ2.o CTRTextureDetailMap2.o CTRTextureGouraudAdd2.o CTRTextureGouraudAddNoZ2.o CTRTextureWire2.o CTRTextureLightMap2_Add.o CTRTextureLightMapGouraud2_M4.o IBurningShader.o CTRTextureBlend.o CTRTextureGouraudAlpha.o CTRTextureGouraudAlphaNoZ.o CDepthBuffer.o CBurningShader_Raster_Reference.o 48IRRIOOBJ = CFileList.o CFileSystem.o CLimitReadFile.o CMemoryFile.o CReadFile.o CWriteFile.o CXMLReader.o CXMLWriter.o CWADReader.o CZipReader.o CPakReader.o CNPKReader.o CTarReader.o CMountPointReader.o irrXML.o CAttributes.o lzma/LzmaDec.o 49IRROTHEROBJ = CIrrDeviceSDL.o CIrrDeviceLinux.o CIrrDeviceConsole.o CIrrDeviceStub.o CIrrDeviceWin32.o CIrrDeviceFB.o CLogger.o COSOperator.o Irrlicht.o os.o 50IRRGUIOBJ = CGUIButton.o CGUICheckBox.o CGUIComboBox.o CGUIContextMenu.o CGUIEditBox.o CGUIEnvironment.o CGUIFileOpenDialog.o CGUIFont.o CGUIImage.o CGUIInOutFader.o CGUIListBox.o CGUIMenu.o CGUIMeshViewer.o CGUIMessageBox.o CGUIModalScreen.o CGUIScrollBar.o CGUISpinBox.o CGUISkin.o CGUIStaticText.o CGUITabControl.o CGUITable.o CGUIToolBar.o CGUIWindow.o CGUIColorSelectDialog.o CDefaultGUIElementFactory.o CGUISpriteBank.o CGUIImageList.o CGUITreeView.o 51ZLIBOBJ = zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o zlib/uncompr.o zlib/zutil.o 52JPEGLIBOBJ = jpeglib/jcapimin.o jpeglib/jcapistd.o jpeglib/jccoefct.o jpeglib/jccolor.o jpeglib/jcdctmgr.o jpeglib/jchuff.o jpeglib/jcinit.o jpeglib/jcmainct.o jpeglib/jcmarker.o jpeglib/jcmaster.o jpeglib/jcomapi.o jpeglib/jcparam.o jpeglib/jcprepct.o jpeglib/jcsample.o jpeglib/jctrans.o jpeglib/jdapimin.o jpeglib/jdapistd.o jpeglib/jdatadst.o jpeglib/jdatasrc.o jpeglib/jdcoefct.o jpeglib/jdcolor.o jpeglib/jddctmgr.o jpeglib/jdhuff.o jpeglib/jdinput.o jpeglib/jdmainct.o jpeglib/jdmarker.o jpeglib/jdmaster.o jpeglib/jdmerge.o jpeglib/jdpostct.o jpeglib/jdsample.o jpeglib/jdtrans.o jpeglib/jerror.o jpeglib/jfdctflt.o jpeglib/jfdctfst.o jpeglib/jfdctint.o jpeglib/jidctflt.o jpeglib/jidctfst.o jpeglib/jidctint.o jpeglib/jmemmgr.o jpeglib/jmemnobs.o jpeglib/jquant1.o jpeglib/jquant2.o jpeglib/jutils.o jpeglib/jcarith.o jpeglib/jdarith.o jpeglib/jaricom.o 53LIBPNGOBJ = libpng/png.o libpng/pngerror.o libpng/pngget.o libpng/pngmem.o libpng/pngpread.o libpng/pngread.o libpng/pngrio.o libpng/pngrtran.o libpng/pngrutil.o libpng/pngset.o libpng/pngtrans.o libpng/pngwio.o libpng/pngwrite.o libpng/pngwtran.o libpng/pngwutil.o 54LIBAESGM = aesGladman/aescrypt.o aesGladman/aeskey.o aesGladman/aestab.o aesGladman/fileenc.o aesGladman/hmac.o aesGladman/prng.o aesGladman/pwd2key.o aesGladman/sha1.o aesGladman/sha2.o 55BZIP2OBJ = bzip2/blocksort.o bzip2/huffman.o bzip2/crctable.o bzip2/randtable.o bzip2/bzcompress.o bzip2/decompress.o bzip2/bzlib.o 56 57# Next variable is for additional scene nodes etc. of customized Irrlicht versions 58EXTRAOBJ = 59LINKOBJ = $(IRRMESHOBJ) $(IRROBJ) $(IRRPARTICLEOBJ) $(IRRANIMOBJ) \ 60 $(IRRVIDEOOBJ) $(IRRSWRENDEROBJ) $(IRRIOOBJ) $(IRROTHEROBJ) \ 61 $(IRRGUIOBJ) $(LIBAESGM) \ 62 $(EXTRAOBJ) 63 64############### 65#Compiler flags 66CXXINCS = -I../../include -I${LOCALBASE}/include 67CPPFLAGS += $(CXXINCS) -DIRRLICHT_EXPORTS=1 68CXXFLAGS += -Wall -pipe -fno-exceptions -fno-rtti -fstrict-aliasing 69ifndef NDEBUG 70CXXFLAGS += -g -D_DEBUG 71endif 72ifdef PROFILE 73CXXFLAGS += -pg 74endif 75 76sharedlib sharedlib_osx: CXXFLAGS += -fPIC 77sharedlib sharedlib_osx: CFLAGS += -fPIC 78 79#multilib handling 80ifeq ($(HOSTTYPE), x86_64) 81LIBSELECT=64 82endif 83 84#Linux specific options 85staticlib sharedlib install: SYSTEM = FreeBSD 86STATIC_LIB = libIrrlicht.a 87LIB_PATH = ../../lib/$(SYSTEM) 88INSTALL_DIR = ${DESTDIR}${PREFIX}/lib 89sharedlib install: SHARED_LIB = libIrrlicht.so 90sharedlib: LDFLAGS += -L${LOCALBASE}/lib -lGL -lXxf86vm -lX11 -lpng -ljpeg -lbz2 -lz 91staticlib sharedlib: CXXINCS += -I${LOCALBASE}/include 92 93#OSX specific options 94staticlib_osx sharedlib_osx install_osx: SYSTEM = MacOSX 95staticlib_osx sharedlib_osx: IRROTHEROBJ += MacOSX/CIrrDeviceMacOSX.o MacOSX/OSXClipboard.o MacOSX/AppDelegate.o 96staticlib_osx sharedlib_osx: CXXINCS += -IMacOSX -I/usr/X11R6/include 97sharedlib_osx install_osx: SHARED_LIB = libIrrlicht.dylib 98staticlib_osx sharedlib_osx: LDFLAGS += --no-export-all-symbols --add-stdcall-alias 99sharedlib_osx: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm 100# for non-X11 app 101#sharedlib_osx: LDFLAGS += -framework cocoa -framework carbon -framework opengl -framework IOKit 102 103#Windows specific options 104IRRLICHT_DLL := ../../bin/Win32-gcc/Irrlicht.dll 105sharedlib_win32 staticlib_win32: SYSTEM = Win32-gcc 106sharedlib_win32: LDFLAGS += -lgdi32 -lopengl32 -ld3dx9d -lwinmm -Wl,--add-stdcall-alias 107#choose either -DIRR_COMPILE_WITH_DX9_DEV_PACK or -DNO_IRR_COMPILE_WITH_DIRECT3D_9_ depending if you need dx9 108#sharedlib_win32 staticlib_win32: CPPFLAGS += -DIRR_COMPILE_WITH_DX9_DEV_PACK 109sharedlib_win32 staticlib_win32: CPPFLAGS += -DNO_IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_ -DNO_IRR_COMPILE_WITH_DIRECT3D_9_ 110sharedlib_win32 staticlib_win32: CPPFLAGS += -DIRR_COMPILE_WITH_DX9_DEV_PACK -D__GNUWIN32__ -D_WIN32 -DWIN32 -D_WINDOWS -D_MBCS -D_USRDLL 111staticlib_win32: CPPFLAGS += -D_IRR_STATIC_LIB_ 112 113VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE) 114SHARED_FULLNAME = $(SHARED_LIB).$(VERSION) 115SONAME = $(SHARED_LIB).$(VERSION_MAJOR).$(VERSION_MINOR) 116 117#################### 118# All target, builds Irrlicht as static lib (libIrrlicht.a) and copies it into lib/Linux 119all linux: staticlib 120 121# Builds Irrlicht as shared lib (libIrrlicht.so.versionNumber) and copies it into lib/Linux 122sharedlib: $(LINKOBJ) 123 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -shared -Wl,-soname,$(SONAME) -o $(SHARED_FULLNAME) $^ $(LDFLAGS) 124 mkdir -p $(LIB_PATH) 125 cp $(SHARED_FULLNAME) $(LIB_PATH) 126 127# Builds Irrlicht as static lib (libIrrlicht.a) 128$(STATIC_LIB): $(LINKOBJ) 129 $(AR) rs $@ $^ 130 131# Copies static lib into lib/Linux 132staticlib staticlib_osx: $(STATIC_LIB) 133 mkdir -p $(LIB_PATH) 134 cp $^ $(LIB_PATH) 135 136# Builds Irrlicht as dll (Irrlicht.dll) into ../../bin/Win32-gcc 137all_win32 win32: sharedlib_win32 138sharedlib_win32: $(IRRLICHT_DLL) 139../../bin/Win32-gcc/Irrlicht.dll: $(LINKOBJ) 140 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -shared -o $@ $^ $(LDFLAGS) -Wl,--out-implib,../../lib/Win32-gcc/$(STATIC_LIB) 141# Copies static lib into /lib/Win32-gcc 142staticlib_win32: $(STATIC_LIB) 143 cp $^ $(LIB_PATH) 144 145# Builds Irrlicht as shared lib (libIrrlicht.so.versionNumber) and copies it into /lib/MacOSX 146sharedlib_osx: $(LINKOBJ) 147 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -dynamiclib -Wl,-install_name,$(SONAME) -o $(SHARED_FULLNAME) $^ $(LDFLAGS) 148 cp $(SHARED_FULLNAME) $(LIB_PATH) 149 150# Installs Irrlicht if it was created as shared lib 151install install_osx: 152 $(RM) -r $(INSTALL_DIR)/../include/irrlicht 153 mkdir -p $(INSTALL_DIR)/../include/irrlicht 154 cp ../../include/*.h $(INSTALL_DIR)/../include/irrlicht/ 155 cp $(LIB_PATH)/$(SHARED_FULLNAME) $(INSTALL_DIR) 156 cd $(INSTALL_DIR) && ln -s -f $(SHARED_FULLNAME) $(SONAME) 157 cd $(INSTALL_DIR) && ln -s -f $(SONAME) $(SHARED_LIB) 158# ldconfig -n $(INSTALL_DIR) 159 160TAGS: 161 ctags *.cpp ../../include/*.h *.h 162 163# Create dependency files for automatic recompilation 164%.d:%.cpp 165 $(CXX) $(CPPFLAGS) -MM -MF $@ $< 166 167# Create dependency files for automatic recompilation 168%.d:%.c 169 $(CC) $(CPPFLAGS) -MM -MF $@ $< 170 171# Create object files from objective-c code 172%.o:%.mm 173 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< 174 175ifneq ($(MAKECMDGOALS),clean) 176-include $(LINKOBJ:.o=.d) 177endif 178 179help: 180 @echo "Available targets for Irrlicht" 181 @echo " sharedlib: Build shared library Irrlicht.so for Linux" 182 @echo " staticlib: Build static library Irrlicht.a for Linux" 183 @echo " install: Copy shared library to /usr/local/lib" 184 @echo "" 185 @echo " sharedlib_win32: Build shared library Irrlicht.dll for Windows" 186 @echo " staticlib_win32: Build static library Irrlicht.a for Windows" 187 @echo "" 188 @echo " clean: Clean up directory" 189 190# Cleans all temporary files and compilation results. 191clean: 192 $(RM) $(LINKOBJ) $(SHARED_FULLNAME) $(STATIC_LIB) $(LINKOBJ:.o=.d) 193 194.PHONY: all sharedlib staticlib sharedlib_win32 staticlib_win32 help install clean 195 196