From f269aa0060950f7b9c42216267c639a2fb556196 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Mon, 26 Mar 2012 22:24:57 +0200 Subject: build system: unify/simplify library handling a bit. libs in $ROOT/lib now add to $(CORE_LIBS) and $(EXTRA_LIBS) and are automatically linked by the core and codecs/plugins respectively. Change-Id: Iff482c792a8c8142718f6a16a450c6e2f1497c9a --- apps/codecs/codecs.make | 17 ++++++++--------- apps/plugins/imageviewer/imageviewer.make | 2 +- apps/plugins/mikmod/mikmod.make | 2 +- apps/plugins/pdbox/pdbox.make | 2 +- apps/plugins/plugins.make | 8 +++++--- 5 files changed, 16 insertions(+), 15 deletions(-) (limited to 'apps') diff --git a/apps/codecs/codecs.make b/apps/codecs/codecs.make index 55002b229b..37713015ad 100644 --- a/apps/codecs/codecs.make +++ b/apps/codecs/codecs.make @@ -21,6 +21,9 @@ include $(APPSDIR)/codecs/lib/tlsf/libtlsf.make include $(APPSDIR)/codecs/lib/libcodec.make OTHER_INC += -I$(APPSDIR)/codecs/lib +# extra libraries +CODEC_LIBS := $(EXTRA_LIBS) $(TLSFLIB) $(CODECLIB) + # the codec libraries include $(APPSDIR)/codecs/demac/libdemac.make include $(APPSDIR)/codecs/liba52/liba52.make @@ -135,7 +138,7 @@ $(CODECDIR)/spc.codec : $(CODECDIR)/libspc.a $(CODECDIR)/mpa.codec : $(CODECDIR)/libmad.a $(CODECDIR)/a52.codec : $(CODECDIR)/liba52.a $(CODECDIR)/flac.codec : $(CODECDIR)/libffmpegFLAC.a -$(CODECDIR)/vorbis.codec : $(CODECDIR)/libtremor.a $(TLSFLIB) +$(CODECDIR)/vorbis.codec : $(CODECDIR)/libtremor.a $(CODECDIR)/speex.codec : $(CODECDIR)/libspeex.a $(CODECDIR)/mpc.codec : $(CODECDIR)/libmusepack.a $(CODECDIR)/wavpack.codec : $(CODECDIR)/libwavpack.a @@ -168,10 +171,7 @@ $(CODECDIR)/sgc.codec : $(CODECDIR)/libsgc.a $(CODECDIR)/libemu2413.a $(CODECDIR)/vgm.codec : $(CODECDIR)/libvgm.a $(CODECDIR)/libemu2413.a $(CODECDIR)/kss.codec : $(CODECDIR)/libkss.a $(CODECDIR)/libemu2413.a -$(CODECS): $(CODECLIB) # this must be last in codec dependency list - -# libfaad and libmusepack both contain a huffman.h file, with different -# content. So we compile them with special command lines: +$(CODECS): $(CODEC_LIBS) # this must be last in codec dependency list # pattern rule for compiling codecs $(CODECDIR)/%.o: $(ROOTDIR)/apps/codecs/%.c @@ -194,14 +194,13 @@ else endif CODECLDFLAGS += $(GLOBAL_LDOPTS) -$(CODECDIR)/%-pre.map: $(CODEC_CRT0) $(CODECLINK_LDS) $(CODECDIR)/%.o $(CODECLIB) +$(CODECDIR)/%-pre.map: $(CODEC_CRT0) $(CODECLINK_LDS) $(CODECDIR)/%.o $(CODECS_LIBS) $(call PRINTS,LD $(@F))$(CC) $(CODECFLAGS) -o $(CODECDIR)/$*-pre.elf \ $(filter %.o, $^) \ - $(filter-out $(CODECLIB),$(filter %.a, $+)) \ - $(CODECLIB) \ + $(filter-out $(CODECLIB),$(filter %.a, $+)) $(CODECLIB) \ -lgcc $(subst .map,-pre.map,$(CODECLDFLAGS)) -$(CODECDIR)/%.codec: $(CODECDIR)/%.o $(LIBSETJMP) $(LIBARMSUPPORT) +$(CODECDIR)/%.codec: $(CODECDIR)/%.o $(call PRINTS,LD $(@F))$(CC) $(CODECFLAGS) -o $(CODECDIR)/$*.elf \ $(filter %.o, $^) \ $(filter %.a, $+) \ diff --git a/apps/plugins/imageviewer/imageviewer.make b/apps/plugins/imageviewer/imageviewer.make index 76cc3e266d..7f7d94320a 100644 --- a/apps/plugins/imageviewer/imageviewer.make +++ b/apps/plugins/imageviewer/imageviewer.make @@ -47,7 +47,7 @@ else endif # rule to create reference map for image decoder -$(IMGVBUILDDIR)/%.refmap: $(APPSDIR)/plugin.h $(IMGVSRCDIR)/imageviewer.h $(PLUGINLINK_LDS) $(LIBARMSUPPORT) $(PLUGINLIB) $(PLUGINBITMAPLIB) +$(IMGVBUILDDIR)/%.refmap: $(APPSDIR)/plugin.h $(IMGVSRCDIR)/imageviewer.h $(PLUGINLINK_LDS) $(PLUGIN_LIBS) $(call PRINTS,LD $(@F))$(CC) $(IMGDECFLAGS) -o /dev/null \ $(filter %.o, $^) \ $(filter %.a, $+) \ diff --git a/apps/plugins/mikmod/mikmod.make b/apps/plugins/mikmod/mikmod.make index c975e1e5c7..38a95c3695 100644 --- a/apps/plugins/mikmod/mikmod.make +++ b/apps/plugins/mikmod/mikmod.make @@ -20,7 +20,7 @@ OTHER_SRC += $(MIKMOD_SRC) MIKMODCFLAGS = $(PLUGINFLAGS) -I$(MIKMODSRCDIR) -O2 -$(MIKMODBUILDDIR)/mikmod.rock: $(MIKMOD_OBJ) $(CODECDIR)/libtlsf.a +$(MIKMODBUILDDIR)/mikmod.rock: $(MIKMOD_OBJ) # new rule needed to use extra compile flags $(MIKMODBUILDDIR)/%.o: $(MIKMODSRCDIR)/%.c diff --git a/apps/plugins/pdbox/pdbox.make b/apps/plugins/pdbox/pdbox.make index 0e40232321..239e1c0852 100644 --- a/apps/plugins/pdbox/pdbox.make +++ b/apps/plugins/pdbox/pdbox.make @@ -18,7 +18,7 @@ PDBOX_OBJ := $(call c2obj, $(PDBOX_SRC)) # add source files to OTHERSRC to get automatic dependencies OTHER_SRC += $(PDBOX_SRC) -$(PDBOXBUILDDIR)/pdbox.rock: $(PDBOX_OBJ) $(MPEG_OBJ) $(CODECDIR)/libtlsf.a +$(PDBOXBUILDDIR)/pdbox.rock: $(PDBOX_OBJ) $(MPEG_OBJ) PDBOXFLAGS = $(PLUGINFLAGS) -fno-strict-aliasing PDBOXLDFLAGS = $(PLUGINLDFLAGS) diff --git a/apps/plugins/plugins.make b/apps/plugins/plugins.make index 272b1b8e93..3ea6d96432 100644 --- a/apps/plugins/plugins.make +++ b/apps/plugins/plugins.make @@ -53,6 +53,8 @@ else PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS) endif +PLUGIN_LIBS := $(EXTRA_LIBS) $(TLSFLIB) $(PLUGINLIB) $(PLUGINBITMAPLIB) + # include .make from each subdir (yay!) $(foreach dir,$(PLUGINSUBDIRS),$(eval include $(dir)/$(notdir $(dir)).make)) @@ -65,7 +67,7 @@ PLUGINFLAGS = -I$(APPSDIR)/plugins -DPLUGIN $(CFLAGS) $(ROCKS1): $(BUILDDIR)/%.rock: $(BUILDDIR)/%.o # dependency for all plugins -$(ROCKS): $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(LIBARMSUPPORT) $(PLUGINLIB) $(PLUGINBITMAPLIB) $(PLUGIN_CRT0) $(LIBSETJMP) +$(ROCKS): $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(PLUGIN_LIBS) $(PLUGIN_CRT0) $(PLUGINLIB): $(PLUGINLIB_OBJ) $(SILENT)$(shell rm -f $@) @@ -85,7 +87,7 @@ $(BUILDDIR)/credits.raw credits.raw: $(DOCSDIR)/CREDITS $(call PRINTS,Create credits.raw)perl $(APPSDIR)/plugins/credits.pl < $< > $(BUILDDIR)/$(@F) # special dependencies -$(BUILDDIR)/apps/plugins/wav2wv.rock: $(BUILDDIR)/apps/codecs/libwavpack.a $(PLUGINLIB) +$(BUILDDIR)/apps/plugins/wav2wv.rock: $(BUILDDIR)/apps/codecs/libwavpack.a $(PLUGIN_LIBS) # Do not use '-ffunction-sections' and '-fdata-sections' when compiling sdl-sim ifeq ($(findstring sdl-sim, $(APP_TYPE)), sdl-sim) @@ -129,7 +131,7 @@ endif $(BUILDDIR)/apps/plugins/%.lua: $(ROOTDIR)/apps/plugins/%.lua $(call PRINTS,CP $(subst $(ROOTDIR)/,,$<))cp $< $(BUILDDIR)/apps/plugins/ -$(BUILDDIR)/%.refmap: $(APPSDIR)/plugin.h $(OVERLAYREF_LDS) $(LIBARMSUPPORT) $(PLUGINLIB) $(PLUGINBITMAPLIB) $(LIBSETJMP) $(PLUGIN_CRT0) +$(BUILDDIR)/%.refmap: $(APPSDIR)/plugin.h $(OVERLAYREF_LDS) $(PLUGIN_LIBS) $(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o /dev/null \ $(filter %.o, $^) \ $(filter %.a, $+) \ -- cgit v1.2.3