1
0
forked from 0ad/0ad

add workspaces/gcc (previously /source/linux)

This was SVN commit r225.
This commit is contained in:
janwas 2004-05-13 17:21:27 +00:00
parent a4a8c56f0f
commit 4b8f4fc07b
5 changed files with 210 additions and 0 deletions

149
source/workspaces/gcc/Makefile Executable file
View File

@ -0,0 +1,149 @@
OBJDIR=o
BINDIR=../../binaries
SRCDIR=..
DEPDIR=deps
INCLUDES=-I$(SRCDIR) -I$(SRCDIR)/ps -I$(SRCDIR)/lib -I. -I/usr/include/X11
# -UDEBUG_LOCKS: Change -U to -D to add printfs in the Lock/Unlock methods of all ThreadUtil.h functions
# -UDEBUG_REFCNT: Change to -D to add printfs in reference counting functions
DEFINES=-D__STDC_VERSION__=199901L -UDEBUG_LOCKS -UDEBUG_REFCNT -DHAVE_X \
-DHAVE_CLOCK_GETTIME -DHAVE_GETTIMEOFDAY
CPPFLAGS=$(INCLUDES) $(DEFINES)
CXXFLAGS=-O3 -mcpu=athlon-4 -march=pentium-mmx -ffast-math \
-foptimize-sibling-calls -fno-cprop-registers \
-fstrict-aliasing -mmmx \
-g3
LD_DIRS=-L/usr/X11R6/lib
LD_LIBS=-lX11 -lrt -lGL -lglut -lSDL -lz -lxerces-c -lpng
LDFLAGS=-g3 -z combreloc $(LD_DIRS) $(LD_LIBS)
PS_SOURCES=$(addprefix ps/, Encryption.cpp CStr.cpp Config.cpp LogFile.cpp \
MathUtil.cpp Parser.cpp Prometheus.cpp XercesErrorHandler.cpp)
PS_OBJS=$(patsubst %.cpp, $(OBJDIR)/%.o, $(PS_SOURCES))
PS_NET_SOURCES=$(addprefix ps/Network/, NetMessage.cpp Network.cpp \
ServerSocket.cpp SocketBase.cpp StreamSocket.cpp)
PS_NET_OBJS=$(patsubst %.cpp, $(OBJDIR)/%.o, $(PS_NET_SOURCES))
GUI_SOURCES=$(addprefix gui/, CButton.cpp CGUI.cpp CGUISprite.cpp GUIbase.cpp \
GUIutil.cpp IGUIButtonBehavior.cpp IGUIObject.cpp \
IGUISettingsObject.cpp CText.cpp IGUIScrollBar.cpp \
IGUIScrollBarOwner.cpp CGUIScrollBarStyle.cpp CGUIScrollBarVertical.cpp)
GUI_OBJS=$(patsubst %.cpp, $(OBJDIR)/%.o, $(GUI_SOURCES))
TERR_SOURCES=$(addprefix terrain/, Camera.cpp Frustum.cpp Matrix3D.cpp \
MiniPatch.cpp Patch.cpp Plane.cpp Renderer.cpp Terrain.cpp Vector3D.cpp\
terrainMain.cpp SHCoeffs.cpp Bound.cpp Quaternion.cpp)
TERR_OBJS=$(patsubst %.cpp, $(OBJDIR)/%.o, $(TERR_SOURCES))
LIB_BASE_SOURCES=$(addprefix lib/, detect.cpp adts.cpp \
misc.cpp ogl.cpp lib.cpp\
sysdep/x.cpp sysdep/sysdep.cpp)
LIB_BASE_OBJS=$(patsubst %.cpp, $(OBJDIR)/%.o, $(LIB_BASE_SOURCES))
LIB_EXT_SOURCES=$(addprefix lib/, input.cpp res/file.cpp \
res/font.cpp res/h_mgr.cpp res/mem.cpp res/res.cpp res/tex.cpp \
res/vfs.cpp res/zip.cpp sysdep/x.cpp timer.cpp)
LIB_EXT_OBJS=$(patsubst %.cpp, $(OBJDIR)/%.o, $(LIB_EXT_SOURCES))
LIB_SOURCES=$(LIB_BASE_SOURCES) $(LIB_EXT_SOURCES)
LIB_OBJS=$(patsubst %.cpp, $(OBJDIR)/%.o, $(LIB_SOURCES))
DEP_SOURCES=$(PS_SOURCES) $(PS_NET_SOURCES) $(GUI_SOURCES) $(LIB_SOURCES) $(TERR_SOURCES)
.PHONY: clean all MPT run runMPT prof runProf
all: .banner $(BINDIR)/prometheus
prof: $(BINDIR)/prometheus.prof
clean:
rm -fr deps o
run: $(BINDIR)/prometheus
pushd $(BINDIR); ./prometheus; popd
runProf: $(BINDIR)/prometheus-prof
pushd $(BINDIR); ./prometheus.prof; popd
runMPT: $(BINDIR)/MessagePassingTest
pushd $(BINDIR); ./MessagePassingTest; popd
include $(patsubst %, $(DEPDIR)/%.d, $(DEP_SOURCES))
.banner:
@echo CFLAGS = $(CFLAGS)
@echo CPPFLAGS = $(CPPFLAGS)
@echo CXXFLAGS = $(CXXFLAGS)
@echo LDFLAGS = $(LDFLAGS)
$(DEPDIR)/%.cpp.d: $(SRCDIR)/%.cpp
@mkdir -p $(dir $@)
@echo D $@
@gcc $(CPPFLAGS) -MM -MT "$(OBJDIR)/$*.o $(DEPDIR)/$*.cpp.d" -MF $@ $<
$(BINDIR)/MessagePassingTest: \
$(OBJDIR)/MessagePassingTest.o \
$(PS_OBJS) \
$(PS_NET_OBJS) \
$(LIB_BASE_OBJS)
@mkdir -p $(dir $@)
$(CXX) $(LDFLAGS) -o $@ $^
MPT: $(BINDIR)/MessagePassingTest
prometheus_OBJS=$(OBJDIR)/main.o \
$(PS_OBJS) \
$(PS_NET_OBJS) \
$(LIB_OBJS) \
$(GUI_OBJS) \
$(TERR_OBJS)
$(BINDIR)/prometheus: $(prometheus_OBJS)
@mkdir -p $(dir $@)
$(CXX) $(LDFLAGS) -o $@ $^
$(BINDIR)/prometheus.prof: $(patsubst %.o, %.prof.o, $(prometheus_OBJS))
@mkdir -p $(dir $@)
$(CXX) $(LDFLAGS) -pg -o $@ $^
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
@mkdir -p $(dir $@)
@echo : $@
@$(CXX) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) -c -o $@ $<
$(OBJDIR)/%.prof.o: $(SRCDIR)/%.cpp
@mkdir -p $(dir $@)
@echo : $@
@$(CXX) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) -pg -c -o $@ $<
$(SRCDIR)/%.ii: $(SRCDIR)/%.cpp
@echo Generating preprocessed file $(notdir $<).ii
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -E -o $(notdir $<).ii $<
winexport:
# Make a copy of <path>/source in <path>/winexport
mkdir -p ../../winexport
cp -r ../../source/* ../../winexport/
pushd ../../winexport; \
rm -fr linux/o; \
rm -fr linux/deps; \
unix2dos `find -type f`; \
popd
winimport:
pushd ../../winimport; \
cp -r * ../source; \
rm -fr vc6/Debug; \
rm -fr vc7/Debug; \
popd; \
pushd ..; \
dos2unix `find -type f`; \
popd
# TODO actual case conversion...
pushd ..; \
for a in `find -type d; do \
mv $a/cvs $a/CVS; \
done; \
popd

1
source/workspaces/gcc/ctime Executable file
View File

@ -0,0 +1 @@

View File

@ -0,0 +1,7 @@
#ifndef _bug_pthread_H
#define _bug_pthread_H
#include "posix.h"
#include "/usr/include/pthread.h"
#endif

View File

@ -0,0 +1,33 @@
Linux build instructions
The Linux build is, so far, a bit hackish. Things might not work on another
system than mine, but it should work. The source/gcc/ folder contains some
header files that exist to override and bug-fix some system headers. If you
have trouble with them, try renaming the offending header, and see if it does
you any good ;-)
What do I need?
- Xerces-C++ installed and in standard include path
- glext.h - you can put it in source/gcc/GL/ if you don't have access to the
system include path
- The Makefile is made for GCC 3.x.x - GCC 2.x might work, but it's not likely
Where are built things put?
The linux makefile follows the general directory layout of the VS workspaces:
source/gcc/: makefile, system header overrides
binaries/: The built binaries - called "prometheus"
source/gcc/deps/: Automatically generated dependency information for all
source files
source/gcc/o/: Object files
Makefile Targets:
all (default): build the prometheus executable
prof: build the prometheus.prof executable (instrumented version with call-counting)
clean: Remove all object, depend, and executable files
run: build prometheus and run it (from the binaries directory)
runProf: build prometheus.prof and run it

View File

@ -0,0 +1,20 @@
#ifndef _bug_time_H
#define _bug_time_H
#include "/usr/include/sys/time.h"
#define __need_time_t
#include <time.h>
#ifndef __timespec_defined
#define __timespec_defined 1
struct timespec {
__time_t tv_sec;
long int tv_nsec;
};
#endif
typedef __time_t time_t;
typedef __clockid_t clockid_t;
#endif