I did not find here a post here that has to do with FMOD and makefile, and I tried to get some help from the FMOD forum, but their database is down. So, here it is.
I'm working on a Linux Ubuntu 12.04 LTS 32-bit. I want to integrate FMOD sound functionality into an air hockey game. I have the functioning game and I have a functioning "example". I'm not very well versed in all sorts of makefile syntax and make-ing an FMOD application, which is why I'm here.
This is the makefile for the example:
x86: main.cpp
g++ -O2 -m32 -o example $< ../../api/lib/libfmodex.so
x64: main.cpp
g++ -O2 -m64 -o example $< ../../api/lib/libfmodex64.so
x86_c: main.c
g++ -O2 -m32 -o example $< ../../api/lib/libfmodex.so
x64_c: main.c
g++ -O2 -m64 -o example $< ../../api/lib/libfmodex64.so
clean:
rm -f example
As I understand, the example makefile can determine what to load in based on what architecture and language you are using. I don't know what flags from the example makefile I should put in what list of flags of the air hockey makefile. I'm afraid to mess it up.
Also, I want to make sure that the game can run on any machine without ever having to refer to /usr/local/include
and /usr/local/lib
that may not exist on the machine.
Newbie here. Any help is very much appreciated.
That makefile will build, depending on which target you tell it, an example binary for one of two architectures from one of two source files. The choices are:
`x86` which builds a 32 bit program from the example C++ source file.
`x64` which builds a 64 bit program from the example C++ source file.
`x86_c` which builds a 32 bit program from the example C source file.
`x64_c` which builds a 64 bit program from the example C source file.
The main part of that code, as far as building your game with FMOD goes, is that it includes the appropriate FMOD shared object file in the compilation line (though in a way I don't normally see done).
You need to include a similar path to the appropriate library in your game's compilation commands or (likely if you are using an FMOD library that has been installed on your system) you just need to include the correct -L
and -l
flags to gcc/g++). -L
to tell the compiler where to search for the FMOD library and -l
to tell it what the library name is (either -lfmodex
or -lfmodex64
for those example cases).