# HG changeset patch # User Matti Hamalainen # Date 1349501497 -10800 # Node ID 112eb95f2fba8af0b3d623c74dab97102b238fff # Parent 3e8e0dc30711ef8e5379f06e5794896f957a6065 Improve build system granularity. diff -r 3e8e0dc30711 -r 112eb95f2fba Makefile.gen --- a/Makefile.gen Sat Oct 06 08:11:47 2012 +0300 +++ b/Makefile.gen Sat Oct 06 08:31:37 2012 +0300 @@ -40,6 +40,7 @@ ### Filesystem ### ifeq ($(DM_USE_PACKFS),yes) +BUILD_RES=yes DM_CFLAGS += -DDM_USE_PACKFS DMLIB_OBJS += dmpack.o dmpackutil.o DM_LDFLAGS += -lz @@ -49,9 +50,18 @@ endif ifeq ($(DM_USE_STDIO),yes) +BUILD_RES=yes DM_CFLAGS += -DDM_USE_STDIO endif +ifeq ($(DM_USE_MEMIO),yes) +BUILD_RES=yes +DM_CFLAGS += -DDM_USE_MEMIO +endif + +ifeq ($(BUILD_RES),yes) +DMLIB_OBJS += dmres.o dmresw.o +endif ### ### Graphics support @@ -76,9 +86,11 @@ DM_CFLAGS += -DDM_GFX_BM_TEXT DMLIB_OBJS += dmtext_bm.o ifeq ($(DM_BUILD_TOOLS),yes) +ifeq ($(DM_USE_STDIO),yes) BINARIES += fontconv endif endif +endif ifeq ($(DM_GFX_TTF_TEXT),yes) DM_CFLAGS += -DDM_GFX_TTF_TEXT @@ -86,10 +98,12 @@ ifeq ($(DM_BUILD_TESTS),yes) ifeq ($(DM_GFX_BLITS),yes) +ifeq ($(DM_USE_STDIO),yes) BINARIES += blittest vview vptest efu endif endif endif +endif ifeq ($(DM_GFX_8BIT),yes) DM_CFLAGS += -DDM_GFX_8BIT @@ -161,7 +175,14 @@ ifeq ($(DM_BUILD_TOOLS),yes) ifeq ($(DM_USE_STDIO),yes) ifeq ($(SUP_MODLOAD),yes) -BINARIES+= viewmod mod2wav testpl ppl +BINARIES+= viewmod mod2wav testpl +ifeq ($(DM_GFX_BM_TEXT),yes) +ifeq ($(DM_GFX_BLITS),yes) +ifeq ($(DM_GFX_MISC),yes) +BINARIES+= ppl +endif +endif +endif endif ifeq ($(JSS_SUP_JSSMOD),yes) @@ -177,6 +198,7 @@ endif + ### ### Rest of the rules ### @@ -190,7 +212,7 @@ DMLIB_A=$(OBJPATH)dmlib.a DMLIB_OBJS += dmfile.o dmlib.o dmlerp.o dmstring.o \ dmargs.o dmvecmat.o dmperlin.o dmimage.o \ - dmres.o dmresw.o dmsimple.o + dmsimple.o ifeq ($(DM_BUILD_TESTS),yes) BINARIES += vecmattest fptest diff -r 3e8e0dc30711 -r 112eb95f2fba dmres.c --- a/dmres.c Sat Oct 06 08:11:47 2012 +0300 +++ b/dmres.c Sat Oct 06 08:31:37 2012 +0300 @@ -7,9 +7,6 @@ #include "dmres.h" #include -#if !defined(DM_USE_PACKFS) && !defined(DM_USE_STDIO) -#error At least one of DM_USE_PACKFS, DM_USE_STDIO must be defined. -#endif #define DMRES_LOCK(x) dmMutexLock(dfResourcesMutex) #define DMRES_UNLOCK(x) dmMutexUnlock(dfResourcesMutex) @@ -395,16 +392,16 @@ dmFree(cbuffer); return res; } -#endif -static void dm_mem_fclose(DMResource * f) +static void dm_pack_fclose(DMResource * f) { f->dataSize = 0; f->dataOffset = 0; dmFree(f->data); f->data = NULL; } +#endif static int dm_mem_ferror(DMResource * f) @@ -496,6 +493,7 @@ } +#ifdef DM_USE_PACKFS DMResourceOps dfPackFileOps = { dm_mem_ferror, @@ -509,9 +507,10 @@ NULL, NULL, - dm_mem_fclose, + dm_pack_fclose, dm_pack_preload }; +#endif DMResourceOps dfMemIOFileOps = @@ -551,7 +550,7 @@ #endif #else - handle->fops = &dfStdioFileOps; + handle->fops = NULL; #endif } }