Help Wanted With Makefile


namco

Member
Joined
Mar 22, 2006
Messages
410
Age
42
Location
Manchester, UK
Website
www.stupendous-stuff.com
I keep getting the following problems when linking the SDL_mixer library:

CODE

C:\openredalert>make
make ../bin/openredalert.gpe CPPFLAGS=" -O2 -g -fmessage-length=0 -D_FORTIFY_SOU
RCE=2 -fPIC -IC:/devkitGP2X/include -IC:/openredalert/src -o"
make[1]: Entering directory `/c/openredalert'
cd ./obj; C:/devkitGP2X/bin/arm-linux-g++ OpenRedAlert.o SoundEngine.o SoundErro
r.o SoundFile.o SoundUtils.o ActionEvent.o ActionEventQueue.o Ai.o AiCommand.o B
AttackAnimEvent.o BExplodeAnimEvent.o BQTimer.o BQueue.o BRepairUnitAnimEvent.o
BTurnAnimEvent.o BarrelExplosionActionEvent.o BuildAnimEvent.o BuildingAnimEvent
.o CncMap.o Comp.o DataLoader.o Dispatcher.o DoorAnimEvent.o ExplosionAnim.o Fib
HeapEntry.o Game.o GameError.o GlobalClearTriggerAction.o GlobalSetTriggerAction
.o InfantryGroup.o KeyComp.o L2Overlay.o LoadMapError.o LoopAnimEvent.o MissionD
ata.o MissionMapsClass.o MissionTheater.o MoneyCounter.o MoveAnimEvent.o MultiPl
ayerMaps.o NoActionTriggerAction.o Path.o Player.o PlayerPool.o ProcAnimEvent.o
Projectile.o ProjectileAnim.o ProjectileData.o ProjectileDataList.o RadarAnimEve
nt.o RawTriggerAction.o RedAlertDataLoader.o RefineAnimEvent.o RepairAnimEvent.o
SnowMissionTheater.o StructureType.o TextTriggerAction.o TriggerAction.o TurnAn
imEvent.o UAttackAnimEvent.o UHarvestEvent.o UInfiltrateAnimEvent.o URepairEvent
.o UnitAnimEvent.o UnitOrStructure.o UnitOrStructureType.o UnitType.o WalkAnimEv
ent.o Warhead.o WarheadData.o WarheadDataList.o Weapon.o WeaponData.o WeaponData
List.o structure.o talkback.o triggers.o unit.o unitandstructurepool.o weaponspo
ol.o Compression.o INIFile.o KeyNotFound.o StringTableFile.o args.o common.o fib
heap.o Button.o Cursor.o CursorInfo.o CursorPool.o DropDownListBox.o Font.o Font
Cache.o Input.o ListboxClass.o Menu.o PauseMenu.o RA_Label.o RA_ProgressBar.o Ra
Window.o SidebarButton.o SidebarError.o TCheckBox.o TTextBox.o logger.o selectio
n.o sidebar.o VFile.o vfs.o blowfish.o mixvfs.o ws-key.o externalvfs.o CPSImage.
o Dune2Image.o GraphicsEngine.o ImageCacheEntry.o ImageNotFound.o MessagePool.o
PCXImage.o Renderer.o SHPBase.o SHPImage.o TemplateImage.o VQAMovie.o VideoError
.o WSAError.o WSAMovie.o imagecache.o imageproc.o loadingscreen.o message.o sdll
ayer.o -LC:/devkitGP2X/lib -static -lSDLmain -lSDL_mixer -lvorbisidec -lmikmod -
lmad -lSDL -lgcc -lm -lc -lexpat -lpthread -o ../bin/openredalert.gpe
C:/devkitGP2X/lib\libmikmod.a(mdriver.o): In function `MD_DropPrivileges':
../playercode/mdriver.c:919: warning: Using 'getpwnam' in statically linked appl
ications requires at runtime the shared libraries from the glibc version used fo
r linking
C:/devkitGP2X/lib\libSDL_mixer.a(music.o): In function `music_internal_position'
:
/home/Administrator/newtoolchain/SDL_mixer-1.2.6/music.c:841: undefined referenc
e to `SMPEG_skip'
/home/Administrator/newtoolchain/SDL_mixer-1.2.6/music.c:843: undefined referenc
e to `SMPEG_rewind'
/home/Administrator/newtoolchain/SDL_mixer-1.2.6/music.c:844: undefined referenc
e to `SMPEG_play'
C:/devkitGP2X/lib\libSDL_mixer.a(music.o): In function `music_internal_volume':
/home/Administrator/newtoolchain/SDL_mixer-1.2.6/music.c:924: undefined referenc
e to `SMPEG_setvolume'
C:/devkitGP2X/lib\libSDL_mixer.a(music.o): In function `music_internal_halt':
/home/Administrator/newtoolchain/SDL_mixer-1.2.6/music.c:992: undefined referenc
e to `SMPEG_stop'
C:/devkitGP2X/lib\libSDL_mixer.a(music.o): In function `music_internal_play':
/home/Administrator/newtoolchain/SDL_mixer-1.2.6/music.c:750: undefined referenc
e to `SMPEG_enableaudio'
/home/Administrator/newtoolchain/SDL_mixer-1.2.6/music.c:751: undefined referenc
e to `SMPEG_enablevideo'
/home/Administrator/newtoolchain/SDL_mixer-1.2.6/music.c:752: undefined referenc
e to `SMPEG_play'
C:/devkitGP2X/lib\libSDL_mixer.a(music.o): In function `Mix_FreeMusic':
/home/Administrator/newtoolchain/SDL_mixer-1.2.6/music.c:663: undefined referenc
e to `SMPEG_delete'
C:/devkitGP2X/lib\libSDL_mixer.a(music.o): In function `music_internal_playing':

/home/Administrator/newtoolchain/SDL_mixer-1.2.6/music.c:1115: undefined referen
ce to `SMPEG_status'
C:/devkitGP2X/lib\libSDL_mixer.a(music.o): In function `music_mixer':
/home/Administrator/newtoolchain/SDL_mixer-1.2.6/music.c:318: undefined referenc
e to `SMPEG_playAudio'
C:/devkitGP2X/lib\libSDL_mixer.a(music.o): In function `Mix_LoadMUS':
/home/Administrator/newtoolchain/SDL_mixer-1.2.6/music.c:568: undefined referenc
e to `SMPEG_new'
/home/Administrator/newtoolchain/SDL_mixer-1.2.6/music.c:573: undefined referenc
e to `SMPEG_actualSpec'
make[1]: *** [../bin/openredalert.gpe] Error 1
make[1]: Leaving directory `/c/openredalert'
make: *** [release] Error 2



I'm sure that I've got the path correct and the libs in the correct order for the file to link properly.

Here's the makefile:

CODE

#############
# generic application Makefile
# you can probably use this makefile for your app by changing the APPNAME variable
#############
APPNAME=openredalert.gpe
TARGET=../bin/$(APPNAME)
VERSION=462
RELEASE=1

#############
# compiler and linker
#############
CPLUSPLUS=C:/devkitGP2X/bin/arm-linux-g++
LINK=$(CPLUSPLUS)

#############
# SDL
#############
SDL_INCLUDE=-IC:/devkitGP2X/include
SDL_LIBS=-LC:/devkitGP2X/lib

#############
# openredalert source and include directories
#############
INC=-IC:/openredalert/src
OPENREDALERT_INCLUDE=$(INC)
SRC=./src ./src/audio ./src/game ./src/misc ./src/ui ./src/vfs ./src/vfs/mix ./src/vfs/filesystem ./src/video
DEST=./obj

#############
# compile parameters
#############
DEFAULT_CPPFLAGS=-O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fPIC
#DEFAULT_CPPFLAGS=$(CPPFLAGS)
CPPFLAGS_RELEASE=
CPPFLAGS_DEBUG=-g
ALL_CPPFLAGS=$(DEFAULT_CPPFLAGS) $(SDL_INCLUDE) $(OPENREDALERT_INCLUDE) -o

# Turns on debugging: to enable run "make -DDEBUG=1"
ifeq ($(DEBUG),1)
ALL_CPPFLAGS += -DDEBUG=1
endif

#############
# linker parameters
#############
#DEFAULT_LD_FLAGS=-fPIC -shared -Wl,-soname,$(TARGET).$(VERSION) -o
DEFAULT_LD_FLAGS=-o
LDFLAGS=$(SDL_LIBS) -static -lSDL_mixer -lvorbisidec -lmikmod -lmad -lSDL -lgcc -lm -lc -lexpat -lpthread $(DEFAULT_LD_FLAGS)

DEP_FILE=$(APPNAME).dep

#############
# tell make where to find the files
#############
vpath %.h $(INC)
vpath %.cpp $(SRC)
vpath %.o $(DEST)

#############
# create object file names from the source file names
#############
src_dirs=$(subst :, ,$(SRC))
source_files=$(foreach dir,$(src_dirs),$(wildcard $(dir)/*.cpp))
header_files=$(foreach dir,src,$(wildcard $(dir)/*.h))
OBJECTS=$(notdir $(patsubst %.cpp,%.o,$(source_files)))

#############
#############
release:
$(MAKE) $(TARGET) CPPFLAGS="$(CPPFLAGS_RELEASE) $(ALL_CPPFLAGS)"

#############
#############
debug:
$(MAKE) $(TARGET) CPPFLAGS="$(CPPFLAGS_DEBUG) $(ALL_CPPFLAGS)"

#############
#############
install:
mkdir -p $(DESTDIR)$(BINDIR)
install -m 755 ${DEST}/$(TARGET) $(DESTDIR)$(BINDIR)/$(TARGET)
# create links ...

#############
#############
clean:
-rm -rf $(DEST) $(TARGET)

#############
#############
depend:
-makedepend -f- -Y -I$(INC) $(source_files) > $(DEP_FILE)

#############
# internal targets
#############
$(TARGET): $(DEST) $(OBJECTS)
cd $(DEST); $(LINK) $(OBJECTS) $(LDFLAGS) $@

#############
#############
$(DEST):
-mkdir -p $(DEST)

#############
#############
$(OBJECTS): %.o: %.cpp
$(CPLUSPLUS) $(ALL_CPPFLAGS) $(DEST)/$@ -c $<

#############
#############
#include $(DEP_FILE)



Can anyone see anything wrong?

Thanks.

Your 6 month wonder.

Namco.

:p
 
Back
Top