2009-11-16 13:13:42 +00:00
|
|
|
# Makefile for building BOINC with MinGW (gcc and gnumake)
|
|
|
|
|
|
|
|
# if you want to use install/uninstall targets, set this to the prefix
|
2011-03-26 02:19:21 +00:00
|
|
|
BOINC_PREFIX ?= /usr/local
|
2009-11-16 13:13:42 +00:00
|
|
|
|
|
|
|
# set this for the BOINC sourc directory. This default should work for calling from within lib/ or api/
|
|
|
|
BOINC_SRC ?= ..
|
|
|
|
|
|
|
|
|
|
|
|
# headers to install
|
2011-03-26 02:19:21 +00:00
|
|
|
HEADERS = $(BOINC_SRC)/version.h \
|
|
|
|
$(BOINC_SRC)/api/boinc_api.h \
|
2011-10-24 23:38:19 +00:00
|
|
|
$(BOINC_SRC)/api/boinc_opencl.h \
|
2011-03-26 02:19:21 +00:00
|
|
|
$(BOINC_SRC)/api/graphics2.h \
|
|
|
|
$(BOINC_SRC)/lib/app_ipc.h \
|
|
|
|
$(BOINC_SRC)/lib/boinc_win.h \
|
|
|
|
$(BOINC_SRC)/lib/url.h \
|
|
|
|
$(BOINC_SRC)/lib/common_defs.h \
|
|
|
|
$(BOINC_SRC)/lib/diagnostics.h \
|
|
|
|
$(BOINC_SRC)/lib/diagnostics_win.h \
|
2011-10-24 23:38:19 +00:00
|
|
|
$(BOINC_SRC)/lib/error_numbers.h \
|
2011-03-26 02:19:21 +00:00
|
|
|
$(BOINC_SRC)/lib/filesys.h \
|
|
|
|
$(BOINC_SRC)/lib/hostinfo.h \
|
|
|
|
$(BOINC_SRC)/lib/proxy_info.h \
|
|
|
|
$(BOINC_SRC)/lib/prefs.h \
|
|
|
|
$(BOINC_SRC)/lib/miofile.h \
|
|
|
|
$(BOINC_SRC)/lib/mfile.h \
|
|
|
|
$(BOINC_SRC)/lib/parse.h \
|
|
|
|
$(BOINC_SRC)/lib/util.h \
|
|
|
|
$(BOINC_SRC)/lib/coproc.h \
|
|
|
|
$(BOINC_SRC)/lib/cal_boinc.h \
|
2011-06-14 13:27:33 +00:00
|
|
|
$(BOINC_SRC)/lib/cl_boinc.h \
|
2011-03-26 02:19:21 +00:00
|
|
|
$(BOINC_SRC)/lib/svn_version.h \
|
|
|
|
$(BOINC_SRC)/win_build/config.h \
|
|
|
|
$(BOINC_SRC)/lib/str_util.h
|
2009-11-16 13:13:42 +00:00
|
|
|
|
|
|
|
ZIP_HEADERS = zip/boinc_zip.h
|
|
|
|
|
|
|
|
# objects to compile
|
|
|
|
|
|
|
|
API_OBJ = boinc_api.o graphics2_util.o
|
|
|
|
|
2011-10-24 23:38:19 +00:00
|
|
|
OCL_OBJ = boinc_opencl.o
|
|
|
|
|
2009-11-16 13:13:42 +00:00
|
|
|
GPH_OBJ = graphics2.o graphics2_util.o
|
|
|
|
|
|
|
|
LIB_OBJ = util.o win_util.o app_ipc.o diagnostics.o diagnostics_win.o filesys.o \
|
2011-10-24 23:38:19 +00:00
|
|
|
hostinfo.o md5.o md5_file.o mem_usage.o mfile.o miofile.o procinfo_win.o procinfo.o proc_control.o parse.o prefs.o \
|
2010-01-21 14:33:43 +00:00
|
|
|
proxy_info.o str_util.o shmem.o base64.o stackwalker_win.o url.o coproc.o
|
2009-11-16 13:13:42 +00:00
|
|
|
|
|
|
|
ZIP_OBJ = boinc_zip.o z_win32.o win32zip.o zipup.o zipfile.o zip.o z_globals.o z_fileio.o \
|
|
|
|
z_util.o trees.o deflate.o zipinfo.o win32.o unzip.o unshrink.o unreduce.o ttyio.o \
|
|
|
|
process.o match.o list.o inflate.o globals.o fileio.o extract.o explode.o envargs.o \
|
|
|
|
crctab.o crc32.o apihelp.o api.o
|
|
|
|
|
|
|
|
|
|
|
|
# libraries to build
|
|
|
|
API_BIN = libboinc_api.a
|
2011-10-24 23:38:19 +00:00
|
|
|
OCL_BIN = libboinc_opencl.a
|
2009-11-16 13:13:42 +00:00
|
|
|
LIB_BIN = libboinc.a
|
|
|
|
GPH_BIN = libboinc_graphics2.a
|
|
|
|
ZIP_BIN = libboinc_zip.a
|
|
|
|
|
|
|
|
# all objects (for clean target)
|
2011-10-24 23:38:19 +00:00
|
|
|
OBJ = $(API_OBJ) $(OCL_OBJ) $(LIB_OBJ) $(GPH_OBJ) $(ZIP_OBJ)
|
2009-11-16 13:13:42 +00:00
|
|
|
|
|
|
|
# all libraries (zip not listed anymore)
|
2011-10-24 23:38:19 +00:00
|
|
|
BIN = $(API_BIN) $(OCL_BIN) $(LIB_BIN) $(GPH_BIN)
|
2009-11-16 13:13:42 +00:00
|
|
|
|
|
|
|
# -gstabs is necessary for MinGWs backtrace to work
|
2011-03-26 02:19:21 +00:00
|
|
|
#DEBUG = -D__DEBUG__ -gstabs -g3
|
|
|
|
DEBUG = -DNDEBUG
|
2009-11-16 13:13:42 +00:00
|
|
|
|
|
|
|
# where to find headers
|
|
|
|
INCS = -I"$(BOINC_SRC)" -I"$(BOINC_SRC)/db" -I"$(BOINC_SRC)/lib" -I"$(BOINC_SRC)/api" -I"$(BOINC_SRC)/zip" -I"$(BOINC_SRC)/win_build"
|
|
|
|
|
|
|
|
|
2011-03-26 02:19:21 +00:00
|
|
|
OPTFLAGS = -O3
|
2009-11-16 13:13:42 +00:00
|
|
|
# various cpp & gcc flags (for both C and C++ mode)
|
|
|
|
# set NOCYGWIN=-mno-cygwin to build non-Cywin Windows libs under Cygwin
|
|
|
|
# -D_WIN32_WINDOWS=0x0410 sets to use Win98 API
|
2011-03-26 02:19:21 +00:00
|
|
|
WINVERFLAGS = -D_WINDOWS -D_WIN32 -DWIN32 -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_MT
|
|
|
|
HAVEFLAGS = -DHAVE_STRCASECMP
|
2009-11-16 13:13:42 +00:00
|
|
|
CCXXFLAGS = $(INCS) $(DEBUG) --include $(BOINC_SRC)/version.h -DEINSTEINATHOME_CROSS_BUILD -DMINGW_WIN32 \
|
2011-03-26 02:19:21 +00:00
|
|
|
$(HAVEFLAGS) $(WINVERFLAGS) -DBOINC \
|
|
|
|
-DNODB -D_CONSOLE -fexceptions $(OPTFLAGS) $(NOCYGWIN)
|
2009-11-16 13:13:42 +00:00
|
|
|
|
|
|
|
# flags for compiling boinc_zip
|
2011-03-26 02:19:21 +00:00
|
|
|
ZIP_FLAGS = -DWIN32 -D_LIB -D_MBCS -DNO_MKTEMP $(INCS) -O2 -DDLL $(NOCYGWIN)
|
2009-11-16 13:13:42 +00:00
|
|
|
|
2011-03-26 02:19:21 +00:00
|
|
|
# LDFLAGS = -lwinmm
|
2009-11-16 13:13:42 +00:00
|
|
|
|
|
|
|
CFLAGS = $(CCXXFLAGS)
|
|
|
|
CXXFLAGS = $(CCXXFLAGS)
|
|
|
|
|
|
|
|
# default target
|
|
|
|
all: $(BIN)
|
|
|
|
|
|
|
|
# zip target
|
|
|
|
boinc_zip: $(ZIP_BIN)
|
|
|
|
|
|
|
|
# rules for the indivisual libraries
|
|
|
|
$(API_BIN): $(API_OBJ)
|
|
|
|
$(AR) rc $@ $^
|
2011-10-24 23:38:19 +00:00
|
|
|
$(OCL_BIN): $(OCL_OBJ)
|
|
|
|
$(AR) rc $@ $^
|
2009-11-16 13:13:42 +00:00
|
|
|
$(LIB_BIN): $(LIB_OBJ)
|
|
|
|
$(AR) rc $@ $^
|
|
|
|
$(GPH_BIN): $(GPH_OBJ)
|
|
|
|
$(AR) rc $@ $^
|
|
|
|
$(ZIP_BIN): $(ZIP_OBJ)
|
|
|
|
$(AR) rc $@ $^
|
|
|
|
|
|
|
|
# standard BOINC code - .C and .cpp versions
|
|
|
|
%.o: $(BOINC_SRC)/api/%.C
|
|
|
|
$(CXX) -c $< -o $@ $(CPPFLAGS) $(CXXFLAGS)
|
|
|
|
%.o: $(BOINC_SRC)/lib/%.C
|
|
|
|
$(CXX) -c $< -o $@ $(CPPFLAGS) $(CXXFLAGS)
|
|
|
|
%.o: $(BOINC_SRC)/api/%.cpp
|
|
|
|
$(CXX) -c $< -o $@ $(CPPFLAGS) $(CXXFLAGS)
|
|
|
|
%.o: $(BOINC_SRC)/lib/%.cpp
|
|
|
|
$(CXX) -c $< -o $@ $(CPPFLAGS) $(CXXFLAGS)
|
|
|
|
|
|
|
|
# C-mode file
|
|
|
|
md5.o: $(BOINC_SRC)/lib/md5.c
|
|
|
|
$(CXX) -c $(BOINC_SRC)/lib/md5.c -o md5.o $(CPPFLAGS) $(CXXFLAGS)
|
|
|
|
|
|
|
|
# for boinc_zip. Don't change the order!
|
|
|
|
%.o: $(BOINC_SRC)/zip/%.cpp
|
|
|
|
$(CXX) -c $< -o $@ $(ZIP_FLAGS)
|
|
|
|
%.o: $(BOINC_SRC)/zip/unzip/win32/%.c
|
|
|
|
$(CC) -c $< -o $@ $(ZIP_FLAGS)
|
|
|
|
%.o: $(BOINC_SRC)/zip/unzip/%.c
|
|
|
|
$(CC) -c $< -o $@ $(ZIP_FLAGS)
|
|
|
|
%.o: $(BOINC_SRC)/zip/zip/win32/%.c
|
|
|
|
$(CC) -c $< -o $@ $(ZIP_FLAGS)
|
|
|
|
%.o: $(BOINC_SRC)/zip/zip/%.c
|
|
|
|
$(CC) -c $< -o $@ $(ZIP_FLAGS)
|
|
|
|
z_util.o: $(BOINC_SRC)/zip/zip/util.c
|
|
|
|
$(CC) -c $< -o $@ $(ZIP_FLAGS)
|
|
|
|
|
2010-10-20 11:28:02 +00:00
|
|
|
$(BOINC_SRC)/lib/svn_version.h:
|
|
|
|
cd $(BOINC_SRC)/lib && sh ../generate_svn_version.sh
|
|
|
|
|
2009-11-16 13:13:42 +00:00
|
|
|
# set to the target ranlib when cross-compiling
|
|
|
|
RANLIB ?= ranlib
|
|
|
|
|
|
|
|
# additional targets
|
|
|
|
|
|
|
|
install: $(BIN) $(HEADERS)
|
2011-03-26 02:19:21 +00:00
|
|
|
mkdir -p $(BOINC_PREFIX)/include/boinc $(BOINC_PREFIX)/lib
|
2010-03-05 12:51:22 +00:00
|
|
|
cp $(HEADERS) $(BOINC_PREFIX)/include/boinc
|
2009-11-16 13:13:42 +00:00
|
|
|
$(RANLIB) $(BIN)
|
|
|
|
cp $(BIN) $(BOINC_PREFIX)/lib
|
|
|
|
|
|
|
|
install-zip: $(ZIP_BIN) $(ZIP_HEADERS)
|
2011-03-26 02:19:21 +00:00
|
|
|
mkdir -p $(BOINC_PREFIX)/include/ $(BOINC_PREFIX)/lib
|
|
|
|
cp $(ZIP_HEADERS) $(BOINC_PREFIX)/include/
|
2009-11-16 13:13:42 +00:00
|
|
|
$(RANLIB) $(ZIP_BIN)
|
|
|
|
cp $(ZIP_BIN) $(BOINC_PREFIX)/lib
|
|
|
|
|
2011-03-26 02:19:21 +00:00
|
|
|
uninstall:
|
|
|
|
${RM} -rf $(BOINC_PREFIX)/include/boinc
|
2011-10-24 23:38:19 +00:00
|
|
|
${RM} $(BOINC_PREFIX)/lib/libboinc.a $(BOINC_PREFIX)/lib/libboinc_api.a $(BOINC_PREFIX)/lib/libboinc_opencl.a $(BOINC_PREFIX)/lib/libboinc_graphics2.a
|
2009-11-16 13:13:42 +00:00
|
|
|
( cd $(BOINC_PREFIX)/lib && rm -f $(BIN) || exit 0 )
|
|
|
|
|
|
|
|
clean:
|
|
|
|
${RM} $(OBJ) $(BIN) $(ZIP_BIN)
|