make.sh and Makefile changed

pull/37/head
yuqing 2018-05-22 17:32:04 +08:00
parent bbcd9f492d
commit 6d9d71005a
13 changed files with 59 additions and 51 deletions

11
make.sh
View File

@ -36,6 +36,8 @@ for col in $output; do
done
/bin/rm -f a.out $tmp_src_filename
TARGET_PREFIX=$DESTDIR/usr
if [ "$int_bytes" -eq 8 ]; then
OS_BITS=64
LIB_VERSION=lib64
@ -72,6 +74,8 @@ elif [ "$uname" = "FreeBSD" ] || [ "$uname" = "Darwin" ]; then
IOEVENT_USE=IOEVENT_USE_KQUEUE
if [ "$uname" = "Darwin" ]; then
CFLAGS="$CFLAGS -DDARWIN"
TARGET_PREFIX=$TARGET_PREFIX/local
LIB_VERSION=lib
fi
if [ -f /usr/include/sys/vmmeter.h ]; then
@ -147,9 +151,10 @@ sed_replace()
cd src
cp Makefile.in Makefile
sed_replace "s/\\\$(CFLAGS)/$CFLAGS/g" Makefile
sed_replace "s/\\\$(LIBS)/$LIBS/g" Makefile
sed_replace "s/\\\$(LIB_VERSION)/$LIB_VERSION/g" Makefile
sed_replace "s#\\\$(CFLAGS)#$CFLAGS#g" Makefile
sed_replace "s#\\\$(LIBS)#$LIBS#g" Makefile
sed_replace "s#\\\$(TARGET_PREFIX)#$TARGET_PREFIX#g" Makefile
sed_replace "s#\\\$(LIB_VERSION)#$LIB_VERSION#g" Makefile
make $1 $2 $3
if [ "$1" = "clean" ]; then

View File

@ -3,6 +3,7 @@
COMPILE = $(CC) $(CFLAGS)
INC_PATH =
LIB_PATH = $(LIBS)
TARGET_LIB = $(TARGET_PREFIX)/$(LIB_VERSION)
FAST_SHARED_OBJS = hash.lo chain.lo shared_func.lo ini_file_reader.lo \
logger.lo sockopt.lo base64.lo sched_thread.lo \
@ -59,11 +60,13 @@ libfastcommon.a: $(FAST_STATIC_OBJS)
.c.lo:
$(COMPILE) -c -fPIC -o $@ $< $(INC_PATH)
install:
mkdir -p $(DESTDIR)/usr/$(LIB_VERSION)
mkdir -p $(DESTDIR)/usr/lib
install -m 755 $(SHARED_LIBS) $(DESTDIR)/usr/$(LIB_VERSION)
mkdir -p $(DESTDIR)/usr/include/fastcommon
install -m 644 $(HEADER_FILES) $(DESTDIR)/usr/include/fastcommon
mkdir -p $(TARGET_LIB)
mkdir -p $(TARGET_PREFIX)/lib
mkdir -p $(TARGET_PREFIX)/include/fastcommon
install -m 755 $(SHARED_LIBS) $(TARGET_LIB)
install -m 644 $(HEADER_FILES) $(TARGET_PREFIX)/include/fastcommon
if [ ! -e $(TARGET_PREFIX)/lib/libfastcommon.so ]; then ln -s $(TARGET_LIB)/libfastcommon.so $(TARGET_PREFIX)/lib/libfastcommon.so; fi
clean:
rm -f $(ALL_OBJS) $(ALL_PRGS) $(ALL_LIBS)

View File

@ -1,7 +1,7 @@
.SUFFIXES: .c .o
COMPILE = $(CC) -g -O1 -Wall -D_FILE_OFFSET_BITS=64 -g -DDEBUG_FLAG
INC_PATH = -I/usr/include/fastcommon
INC_PATH = -I/usr/local/include
LIB_PATH = -lfastcommon -lpthread
ALL_PRGS = test_allocator test_skiplist test_multi_skiplist test_mblock test_blocked_queue \

View File

@ -5,11 +5,11 @@
#include <time.h>
#include <inttypes.h>
#include <sys/time.h>
#include "logger.h"
#include "shared_func.h"
#include "sched_thread.h"
#include "ini_file_reader.h"
#include "fast_allocator.h"
#include "fastcommon/logger.h"
#include "fastcommon/shared_func.h"
#include "fastcommon/sched_thread.h"
#include "fastcommon/ini_file_reader.h"
#include "fastcommon/fast_allocator.h"
#define OUTER_LOOP_COUNT 128
#define INNER_LOOP_COUNT 1024 * 64

View File

@ -5,12 +5,12 @@
#include <time.h>
#include <inttypes.h>
#include <sys/time.h>
#include "logger.h"
#include "shared_func.h"
#include "sched_thread.h"
#include "ini_file_reader.h"
#include "fast_task_queue.h"
#include "fast_blocked_queue.h"
#include "fastcommon/logger.h"
#include "fastcommon/shared_func.h"
#include "fastcommon/sched_thread.h"
#include "fastcommon/ini_file_reader.h"
#include "fastcommon/fast_task_queue.h"
#include "fastcommon/fast_blocked_queue.h"
static bool g_continue_flag = true;
static int64_t produce_count = 0;

View File

@ -7,9 +7,9 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include "logger.h"
#include "char_convert_loader.h"
#include "char_converter.h"
#include "fastcommon/logger.h"
#include "fastcommon/char_convert_loader.h"
#include "fastcommon/char_converter.h"
int main(int argc, char *argv[])
{

View File

@ -7,10 +7,10 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include "logger.h"
#include "ini_file_reader.h"
#include "char_convert_loader.h"
#include "char_converter.h"
#include "fastcommon/logger.h"
#include "fastcommon/ini_file_reader.h"
#include "fastcommon/char_convert_loader.h"
#include "fastcommon/char_converter.h"
int main(int argc, char *argv[])
{

View File

@ -7,12 +7,12 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include "logger.h"
#include "shared_func.h"
#include "sched_thread.h"
#include "ini_file_reader.h"
#include "sockopt.h"
#include "id_generator.h"
#include "fastcommon/logger.h"
#include "fastcommon/shared_func.h"
#include "fastcommon/sched_thread.h"
#include "fastcommon/ini_file_reader.h"
#include "fastcommon/sockopt.h"
#include "fastcommon/id_generator.h"
int main(int argc, char *argv[])
{

View File

@ -7,9 +7,9 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include "logger.h"
#include "shared_func.h"
#include "ini_file_reader.h"
#include "fastcommon/logger.h"
#include "fastcommon/shared_func.h"
#include "fastcommon/ini_file_reader.h"
static int iniAnnotationFuncExpressCalc(char *param, char **pOutValue, int max_values)
{

View File

@ -7,7 +7,7 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include "logger.h"
#include "fastcommon/logger.h"
int main(int argc, char *argv[])
{

View File

@ -7,14 +7,14 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include "logger.h"
#include "shared_func.h"
#include "sched_thread.h"
#include "ini_file_reader.h"
#include "fast_mblock.h"
#include "sockopt.h"
#include "system_info.h"
#include "local_ip_func.h"
#include "fastcommon/logger.h"
#include "fastcommon/shared_func.h"
#include "fastcommon/sched_thread.h"
#include "fastcommon/ini_file_reader.h"
#include "fastcommon/fast_mblock.h"
#include "fastcommon/sockopt.h"
#include "fastcommon/system_info.h"
#include "fastcommon/local_ip_func.h"
struct my_struct {
struct fast_mblock_man *mblock;

View File

@ -6,9 +6,9 @@
#include <assert.h>
#include <inttypes.h>
#include <sys/time.h>
#include "multi_skiplist.h"
#include "logger.h"
#include "shared_func.h"
#include "fastcommon/multi_skiplist.h"
#include "fastcommon/logger.h"
#include "fastcommon/shared_func.h"
#define COUNT 1000000
#define LEVEL_COUNT 16

View File

@ -6,9 +6,9 @@
#include <assert.h>
#include <inttypes.h>
#include <sys/time.h>
#include "skiplist.h"
#include "logger.h"
#include "shared_func.h"
#include "fastcommon/skiplist.h"
#include "fastcommon/logger.h"
#include "fastcommon/shared_func.h"
#define COUNT 1000000
#define LEVEL_COUNT 16