Ok. I have a project I am working on that uses the cross platform library "Allegro". My problem is this:
When compiling under linux, I need to use the `allegro-config` script for g++ library paths, etc...
In dos (DJGPP) however, I need to manually do this.
Ontop of this difference, in DJGPP, the C++ compiler is called gpp, and on linux its called g++, how do I add different OS sections to my Makefile???
Makefile-linux:
Code:
SOURCES = source/main.cpp \
source/screen.cpp \
source/game.cpp \
source/editor.cpp \
source/spriteeditor.cpp \
source/sprite.cpp \
source/file.cpp \
source/gstring.cpp \
source/map.cpp
OBJS = ${SOURCES:.cpp=.o}
CFLAGS = -O3 -Iinclude/ -I. `allegro-config --cflags`
LIBS = -lm `allegro-config --libs`
CC = g++
PACKAGE = game
all : ${OBJS}
${CC} ${CFLAGS} -o ${PACKAGE} ${OBJS} ${LIBS}
.cpp.o:
${CC} ${CFLAGS} -c $< -o ${<:.cpp=.o}
clean :
rm -fr *.o
rm -fr source/*.o
# end of file
Makefile-dos:
Code:
SOURCES = source/main.cpp \
source/screen.cpp \
source/game.cpp \
source/editor.cpp \
source/spriteeditor.cpp \
source/sprite.cpp \
source/file.cpp \
source/gstring.cpp \
source/map.cpp
OBJS = ${SOURCES:.cpp=.o}
CFLAGS = -O3 -Iinclude/ -I. -LC:\DJGPP\ALLEGRO\LIBS\DJGPP -IC:\DJGPP\ALLEGRO\INCLUDE
LIBS = -lm -lalleg
CC = gpp
PACKAGE = game.exe
all : ${OBJS}
${CC} ${CFLAGS} -o ${PACKAGE} ${OBJS} ${LIBS}
.cpp.o:
${CC} ${CFLAGS} -c $< -o ${<:.cpp=.o}
clean :
rm -fr *.o
rm -fr source/*.o
# end of file
How do I make one make file that does both DJGPP and Linux???