Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Custom Makefile...  (Read 1850 times)

0 Members and 1 Guest are viewing this topic.

cheeseboy

  • Newbie
  • *
  • Posts: 36
    • View Profile
Custom Makefile...
« on: May 13, 2013, 07:21:47 am »
Because I want to statically link openal and everything else and also i'm not a fan of cmake...
I have written a custom makefile:
CXX := i686-w64-mingw32-g++
CFLAGS := -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./
LDFLAGS := -lOpenAL32 -lsndfile -ldsound -lwinmm -lole32

WIN32_SOURCES := $(wildcard SFML/System/Win32/*.cpp)
WIN32_OBJECTS := $(patsubst %.cpp,%.o,$(WIN32_SOURCES))

SYSTEM_SOURCES := $(wildcard SFML/System/*.cpp)
SYSTEM_OBJECTS := $(patsubst %.cpp,%.o,$(SYSTEM_SOURCES))

AUDIO_SOURCES := $(wildcard SFML/Audio/*.cpp)
AUDIO_OBJECTS := $(patsubst %.cpp,%.o,$(AUDIO_SOURCES))

all: main win32 system audio
        ${CXX} -shared ${WIN32_OBJECTS} ${SYSTEM_OBJECTS} -o libsfml-system-s.a
        ${CXX} -shared -L./ ${AUDIO_OBJECTS} -o libsfml-audio-s.a -lsfml-system-s ${LDFLAGS}

main: SFML/Main/SFML_Main.cpp SFML/Main/SFML_Main.o

win32: ${WIN32_OBJECTS}

system: ${SYSTEM_OBJECTS}

audio: ${AUDIO_OBJECTS}

%.o: %.cpp
        ${CXX} ${CFLAGS} -c $< -o $@
       
clean:
        find . -name "*.o" -exec rm {} \;
        find . -name "*.a" -exec rm {} \;
 

No errors on output:
greg@greg-laptop ~/enigma-dev/ENIGMAsystem/Additional/Windows/sfml $ make
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/Main/SFML_Main.cpp -o SFML/Main/SFML_Main.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/System/Win32/ClockImpl.cpp -o SFML/System/Win32/ClockImpl.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/System/Win32/ThreadImpl.cpp -o SFML/System/Win32/ThreadImpl.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/System/Win32/SleepImpl.cpp -o SFML/System/Win32/SleepImpl.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/System/Win32/ThreadLocalImpl.cpp -o SFML/System/Win32/ThreadLocalImpl.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/System/Win32/MutexImpl.cpp -o SFML/System/Win32/MutexImpl.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/System/Thread.cpp -o SFML/System/Thread.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/System/Clock.cpp -o SFML/System/Clock.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/System/Time.cpp -o SFML/System/Time.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/System/Sleep.cpp -o SFML/System/Sleep.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/System/String.cpp -o SFML/System/String.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/System/Lock.cpp -o SFML/System/Lock.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/System/ThreadLocal.cpp -o SFML/System/ThreadLocal.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/System/Mutex.cpp -o SFML/System/Mutex.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/System/Err.cpp -o SFML/System/Err.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/Audio/Listener.cpp -o SFML/Audio/Listener.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/Audio/AudioDevice.cpp -o SFML/Audio/AudioDevice.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/Audio/SoundBufferRecorder.cpp -o SFML/Audio/SoundBufferRecorder.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/Audio/SoundFile.cpp -o SFML/Audio/SoundFile.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/Audio/SoundRecorder.cpp -o SFML/Audio/SoundRecorder.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/Audio/SoundBuffer.cpp -o SFML/Audio/SoundBuffer.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/Audio/Music.cpp -o SFML/Audio/Music.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/Audio/ALCheck.cpp -o SFML/Audio/ALCheck.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/Audio/SoundSource.cpp -o SFML/Audio/SoundSource.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/Audio/Sound.cpp -o SFML/Audio/Sound.o
i686-w64-mingw32-g++ -DAL_LIBTYPE_STATIC -DSFML_STATIC -I./include -I./ -c SFML/Audio/SoundStream.cpp -o SFML/Audio/SoundStream.o
i686-w64-mingw32-g++ -shared SFML/System/Win32/ClockImpl.o SFML/System/Win32/ThreadImpl.o SFML/System/Win32/SleepImpl.o SFML/System/Win32/ThreadLocalImpl.o SFML/System/Win32/MutexImpl.o SFML/System/Thread.o SFML/System/Clock.o SFML/System/Time.o SFML/System/Sleep.o SFML/System/String.o SFML/System/Lock.o SFML/System/ThreadLocal.o SFML/System/Mutex.o SFML/System/Err.o -o libsfml-system-s.a
i686-w64-mingw32-g++ -shared -L./ SFML/Audio/Listener.o SFML/Audio/AudioDevice.o SFML/Audio/SoundBufferRecorder.o SFML/Audio/SoundFile.o SFML/Audio/SoundRecorder.o SFML/Audio/SoundBuffer.o SFML/Audio/Music.o SFML/Audio/ALCheck.o SFML/Audio/SoundSource.o SFML/Audio/Sound.o SFML/Audio/SoundStream.o -o libsfml-audio-s.a -lsfml-system-s -lOpenAL32 -lsndfile -ldsound -lwinmm -lole32

but when trying to link against it:
eobjs/Linux/Windows/Run/Universal_System/Extensions/MotionPlanning/mp_movement.o .eobjs/Linux/Windows/Run/Universal_System/Extensions/DateTime/date_time.o .eobjs/Linux/Windows/Run/Universal_System/Extensions/DataStructures/data_structures.o  -lffi -lcomdlg32 -lgdi32 -lwinmm -lopengl32 -lglu32 -lsfml-audio-s -lsfml-system-s -lz
.eobjs/Linux/Windows/Run/Audio_Systems/SFML/SFML_basic.o:SFML_basic.cpp:(.text+0x457): undefined reference to `sf::SoundBuffer::SoundBuffer()'

and etc.

Any idea where I messed up?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Custom Makefile...
« Reply #1 on: May 13, 2013, 08:03:30 am »
I have no idea, everything looks correct :-\
Laurent Gomila - SFML developer

cheeseboy

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Custom Makefile...
« Reply #2 on: May 13, 2013, 10:06:06 am »
but... :(