# # $Id$ # # $Date$ # $Revision$ # # (C) 1999 by Hyperion # All rights reserved # # This file is part of the MiniGL library project # See the file Licence.txt for more details # # ifneq ($(shell uname), AmigaOS) INSTALLPATH = /SDK/local/newlib INCLUDEINSTALLPATH= /SDK/local/common CC = ppc-amigaos-gcc CXX = ppc-amigaos-c++ AR = ppc-amigaos-ar RANLIB = ppc-amigaos-ranlib COPY = cp -v MAKEDIR = mkdir STRIP = ppc-amigaos-strip PROTECT = true DELETE = rm else INSTALLPATH = SDK:local/newlib INCLUDEINSTALLPATH = SDK:local/common #INSTALLPATH = SDK:local/clib2 CC = gcc CXX = c++ AR = ar RANLIB = ranlib COPY = copy QUIET MAKEDIR = makedir FORCE STRIP = strip PROTECT = protect DELETE = delete endif INCLUDE = -Iinclude -Isrc -Isrc/glu DEBUG = -ggdb MGLNAME = minigl.library MGLSTUB = libGL.a GLUSTUB = libGLU.a GLUTNAME = mglut.library GLUTSTUB = libglut.a CRT = -mcrt=newlib CFLAGS = $(INCLUDE) $(DEBUG) -gstabs -O3 -Wall -DMINIGL \ -mno-longcall -ffast-math -ffinite-math-only \ -std=c99 -fgnu89-inline -fstrict-aliasing -mstrict-align $(CRT) CFLAGS_ALTIVEC = $(CLFAGS) -maltivec -mabi=altivec CXXFLAGS = $(INCLUDE) $(DEBUG) -gstabs -O3 -Wall -DMINIGL \ -fno-strict-aliasing $(CRT) -fno-rtti -fno-exceptions \ -Isrc/glu/libnurbs/interface -Isrc/glu/libnurbs/internals \ -Isrc/glu/libnurbs/nurbtess -mstrict-align -DNDEBUG -DLIBRARYBUILD DEMOS = alpha gears cube bounce warp texsub multitex plane gears2 envcombine mipmap \ fogging points lines glinfo clip rasonly aargb stars glutplane \ drawf polygonmode attrib font list stroke torus gears3 morph3d pickdepth picksquare select \ bezcurve bezmesh bezsurf texturesurf fullscreen logo clipcube drawbuffer \ quadric tesswind surface trim drawpixels timerfunc logicop image cel-shading spots GLUSRCTESS = src/glu/libtess/dict.c src/glu/libtess/normal.c src/glu/libtess/sweep.c \ src/glu/libtess/geom.c src/glu/libtess/tess.c \ src/glu/libtess/memalloc.c src/glu/libtess/priorityq.c src/glu/libtess/tessmono.c \ src/glu/libtess/mesh.c src/glu/libtess/render.c GLUSRCUTIL = src/glu/libutil/error.c src/glu/libutil/glue.c src/glu/libutil/mipmap.c \ src/glu/libutil/project.c src/glu/libutil/quad.c src/glu/libutil/registry.c GLUSRCNURB = src/glu/libnurbs/interface/bezierEval.cc \ src/glu/libnurbs/interface/bezierPatch.cc \ src/glu/libnurbs/interface/bezierPatchMesh.cc \ src/glu/libnurbs/interface/glcurveval.cc \ src/glu/libnurbs/interface/glinterface.cc \ src/glu/libnurbs/interface/glrenderer.cc \ src/glu/libnurbs/interface/glsurfeval.cc \ src/glu/libnurbs/interface/incurveeval.cc \ src/glu/libnurbs/interface/insurfeval.cc \ src/glu/libnurbs/internals/arc.cc \ src/glu/libnurbs/internals/arcsorter.cc \ src/glu/libnurbs/internals/arctess.cc \ src/glu/libnurbs/internals/backend.cc \ src/glu/libnurbs/internals/basiccrveval.cc \ src/glu/libnurbs/internals/basicsurfeval.cc \ src/glu/libnurbs/internals/bin.cc \ src/glu/libnurbs/internals/bufpool.cc \ src/glu/libnurbs/internals/cachingeval.cc \ src/glu/libnurbs/internals/ccw.cc \ src/glu/libnurbs/internals/coveandtiler.cc \ src/glu/libnurbs/internals/curve.cc \ src/glu/libnurbs/internals/curvelist.cc \ src/glu/libnurbs/internals/curvesub.cc \ src/glu/libnurbs/internals/dataTransform.cc \ src/glu/libnurbs/internals/displaylist.cc \ src/glu/libnurbs/internals/flist.cc \ src/glu/libnurbs/internals/flistsorter.cc \ src/glu/libnurbs/internals/hull.cc \ src/glu/libnurbs/internals/intersect.cc \ src/glu/libnurbs/internals/knotvector.cc \ src/glu/libnurbs/internals/mapdesc.cc \ src/glu/libnurbs/internals/mapdescv.cc \ src/glu/libnurbs/internals/maplist.cc \ src/glu/libnurbs/internals/mesher.cc \ src/glu/libnurbs/internals/monoTriangulationBackend.cc \ src/glu/libnurbs/internals/monotonizer.cc \ src/glu/libnurbs/internals/mycode.cc \ src/glu/libnurbs/internals/nurbsinterfac.cc \ src/glu/libnurbs/internals/nurbstess.cc \ src/glu/libnurbs/internals/patch.cc \ src/glu/libnurbs/internals/patchlist.cc \ src/glu/libnurbs/internals/quilt.cc \ src/glu/libnurbs/internals/reader.cc \ src/glu/libnurbs/internals/renderhints.cc \ src/glu/libnurbs/internals/slicer.cc \ src/glu/libnurbs/internals/sorter.cc \ src/glu/libnurbs/internals/splitarcs.cc \ src/glu/libnurbs/internals/subdivider.cc \ src/glu/libnurbs/internals/tobezier.cc \ src/glu/libnurbs/internals/trimline.cc \ src/glu/libnurbs/internals/trimregion.cc \ src/glu/libnurbs/internals/trimvertpool.cc \ src/glu/libnurbs/internals/uarray.cc \ src/glu/libnurbs/internals/varray.cc \ src/glu/libnurbs/nurbtess/directedLine.cc \ src/glu/libnurbs/nurbtess/gridWrap.cc \ src/glu/libnurbs/nurbtess/monoChain.cc \ src/glu/libnurbs/nurbtess/monoPolyPart.cc \ src/glu/libnurbs/nurbtess/monoTriangulation.cc \ src/glu/libnurbs/nurbtess/partitionX.cc \ src/glu/libnurbs/nurbtess/partitionY.cc \ src/glu/libnurbs/nurbtess/polyDBG.cc \ src/glu/libnurbs/nurbtess/polyUtil.cc \ src/glu/libnurbs/nurbtess/primitiveStream.cc \ src/glu/libnurbs/nurbtess/quicksort.cc \ src/glu/libnurbs/nurbtess/rectBlock.cc \ src/glu/libnurbs/nurbtess/sampleComp.cc \ src/glu/libnurbs/nurbtess/sampleCompBot.cc \ src/glu/libnurbs/nurbtess/sampleCompRight.cc \ src/glu/libnurbs/nurbtess/sampleCompTop.cc \ src/glu/libnurbs/nurbtess/sampleMonoPoly.cc \ src/glu/libnurbs/nurbtess/sampledLine.cc \ src/glu/libnurbs/nurbtess/searchTree.cc \ src/glu/libnurbs/internals/operators.cc MGLSRC = src/library.c src/matrix.c src/context.c src/vertexbuffer.c src/draw.c \ src/texture.c src/fog.c src/hclip.c src/others.c src/init.c src/state.c \ src/vertexarray.c src/light.c src/textureconvert.c src/bitmap.c src/displaylists.c src/smartlock.c \ src/selection.c src/eval.c src/drawpixels.c src/pixel.c src/pack.c src/unpack.c \ src/buffer.c src/video.c src/readpixels.c src/pack_argb.c src/copypixels.c MGLSRC_ALTIVEC = src/altivec_math.c MGLLIBOBJ = $(MGLSRC:.c=.o) src/createcontext.o $(GLUSRCTESS:.c=.o) $(GLUSRCUTIL:.c=.o) $(GLUSRCNURB:.cc=.o) MGLLIBOBJ_ALTIVEC = $(MGLSRC_ALTIVEC:.c=.obj) MGLSTUBSRC = src/mglstub.c src/stubs.c MGLSTUBOBJ = $(MGLSTUBSRC:.c=.o) GLUSTUBSRC = src/glustub.c GLUSTUBOBJ = $(GLUSTUBSRC:.c=.o) GLUTSRC = src/glut.c src/glutlibrary.c src/glut_font.c src/glut_font_definitions.c \ src/glut_font_data.c src/glut_stroke_mono_roman.c src/glut_stroke_roman.c \ src/glut_gamemode.c src/glut_geometry.c src/glut_teapot.c src/glut_state.c \ src/glut_overlay.c src/glut_misc.c src/requesters.c GLUTOBJ = $(GLUTSRC:.c=.o) GLUTSTUBSRC = src/glutstub.c src/stubs.c src/requesters.c GLUTSTUBOBJ = $(GLUTSTUBSRC:.c=.o) DEMOSUP = demos/texload.c MINIGL_VERSION = 2 MGLUT_VERSION = 2 .SILENT: all: $(MGLNAME) lib/$(MGLSTUB) lib/$(GLUSTUB) \ $(GLUTNAME) lib/$(GLUTSTUB) \ install $(DEMOS) # lib/$(MGLSTUB:.a=.so) lib/$(GLUNAME:.a=.so) lib/$(GLUTSTUB:.a=.so) #lib/baserel/$(MGLSTUB) lib: $(MGLNAME) @echo "Done" define PROGRAM_template demos/$(1).o: demos/$(1).c echo Compiling demos/$(1) $(CC) $(CFLAGS) -c demos/$(1).c -o demos/$(1).o $(1): demos/$(1).o $(LIBNAME) demos/texload.o lib/$(GLSTUB) lib/$(GLUTSTUB) lib/$(GLUNAME) echo Linking $(1) $(CC) $(CFLAGS) -g -o $(1).debug demos/$(basename $(1)).o demos/texload.o \ -Llib -lGL -lglut -lGLU -lm -lauto $(STRIP) $(1).debug -o $(1) DEMOS_progs += $(1) DEMOS_progs_debug += $(1).debug endef .PHONY: clean demos revision.minigl revision.mglut revision $(foreach prog,$(DEMOS),$(eval $(call PROGRAM_template,$(prog)))) demos: $(DEMOS) clean: -$(DELETE) src/*.o src/*.obj src/*.bo demos/*.o minigl.library mglut.library \ lib/libGLU.a lib/libglut.a lib/libGL.a lib/baserel/libGL.a -$(DELETE) $(DEMOS_progs) -$(DELETE) $(DEMOS_progs_debug) -$(DELETE) $(GLUSRCTESS:.c=.o) $(GLUSRCUTIL:.c=.o) $(GLUSRCNURB:.cc=.o) src/table.h: include/mgl/minigl.h utilities/gentable.py grep ^MGLAPI include/mgl/minigl.h | python utilities/gentable.py >src/table.h src/stubs.o: src/table.h src/createcontext.o : src/createcontext.c $(CC) $(INCLUDE) $(DEBUG) -gstabs -Wall -DMINIGL -std=gnu99 -fno-strict-aliasing -mstrict-align -mtune=7450 $(CRT) -c $< -o $*.o $(MGLNAME): $(MGLLIBOBJ) $(MGLLIBOBJ_ALTIVEC) echo Linking minigl.library... $(CC) $(CRT) -o $@.debug $(MGLLIBOBJ) $(MGLLIBOBJ_ALTIVEC) -nostartfiles -lm -Wl,--defsym,__cxa_pure_virtual=0 $(STRIP) $@.debug -o $@ $(PROTECT) $@ -e lib/$(MGLSTUB): $(MGLSTUBOBJ) echo Building $*.a $(AR) rc $@ $(MGLSTUBOBJ) lib/baserel/$(MGLSTUB): $(MGLSTUBOBJ:.o=.bo) echo Building $*.a $(AR) rc lib/baserel/$(MGLSTUB) $(MGLSTUBOBJ:.o=.bo) $(GLUTNAME): $(GLUTOBJ) echo Linking mglut.library... $(CC) $(CRT) -o $@.debug $(GLUTOBJ) -Llib -nostartfiles -lm -lGL $(STRIP) $@.debug -o $@ $(PROTECT) $@ -e lib/$(GLUTSTUB): $(GLUTSTUBOBJ) echo Building $*.a $(AR) rc $@ $(GLUTSTUBOBJ) $(GLUNAME): $(GLUOBJ) echo Linking mglu.library... $(CC) $(CRT) -o $@.debug $(GLUOBJ) -Llib -nostartfiles -lm -lGL $(STRIP) $@.debug -o $@ $(PROTECT) $@ -e lib/$(GLUSTUB): $(GLUSTUBOBJ) echo Building $*.a $(AR) rc $@ $(GLUSTUBOBJ) lib/$(MGLSTUB:.a=.so): $(MGLSTUBSRC) echo Building $@ $(CC) -shared -fPIC $(CRT) -o $@ $(MGLSTUBSRC) lib/$(GLUTSTUB:.a=.so): $(GLUTSTUBSRC) echo Building $@ $(CC) -shared -fPIC $(CRT) -o $@ $(GLUTSTUBSRC) lib/$(GLUNAME:.a=.so): $(GLUSRC) echo Building $@ $(CC) -shared -fPIC $(CRT) -o $@ $(GLUSRC) install: $(MGLNAME) @echo Installing... @-$(MAKEDIR) $(INCLUDEINSTALLPATH)/include/mgl @-$(MAKEDIR) $(INCLUDEINSTALLPATH)/include/GL @-$(MAKEDIR) $(INCLUDEINSTALLPATH)/include/interfaces @-$(MAKEDIR) $(INCLUDEINSTALLPATH)/include/proto @-$(MAKEDIR) $(INCLUDEINSTALLPATH)/include/inline4 @-$(MAKEDIR) $(INSTALLPATH)/lib/baserel @$(COPY) lib/*.a $(INSTALLPATH)/lib # @$(COPY) lib/*.so $(INSTALLPATH)/lib @$(COPY) include/mgl/*.h $(INCLUDEINSTALLPATH)/include/mgl @$(COPY) include/GL/*.h $(INCLUDEINSTALLPATH)/include/GL @$(COPY) include/interfaces/*.h $(INCLUDEINSTALLPATH)/include/interfaces @$(COPY) include/proto/*.h $(INCLUDEINSTALLPATH)/include/proto @$(COPY) include/inline4/*.h $(INCLUDEINSTALLPATH)/include/inline4 @$(COPY) lib/libGL.a $(INSTALLPATH)/lib/libmgl.a ifeq ($(shell uname), AmigaOS) @$(COPY) *.library libs: @$(COPY) *.so SObjs: @avail flush else @$(COPY) *.library //192.168.0.9/tfrieden endif # @$(COPY) lib/*.a $(INSTALLPATH)/lib %.o : %.c echo Compiling $< $(CC) $(CFLAGS) -c $< -o $*.o %.obj : %.c echo Compiling $< $(CC) $(CFLAGS_ALTIVEC) -c $< -o $*.obj %.o : %.cc echo Compiling $< $(CXX) $(CXXFLAGS) -c $< -o $*.o %.bo : %.c echo Compiling $< \(baserel\) $(CC) $(CFLAGS) -mbaserel -c $< -o $*.bo src/state.o : src/state.c src/inc.get.c revision.minigl: echo Bumping minigl version bumprev $(MINIGL_VERSION) src/minigl.library revision.mglut: echo Bumping mglut version bumprev $(MGLUT_VERSION) src/mglut.library revision: revision.minigl revision.mglut