Browse Source

Fixing Makefile issue reported in Issue 15 (misspelled flag)

git-svn-id: https://leveldb.googlecode.com/svn/trunk@35 62dab493-f737-651d-591e-8d6aee1b9529
xry
gabor@google.com 13 years ago
parent
commit
85f0ab1975
4 changed files with 6 additions and 180 deletions
  1. +2
    -1
      Makefile
  2. +4
    -4
      build_detect_platform
  3. +0
    -50
      port/port_osx.cc
  4. +0
    -125
      port/port_osx.h

+ 2
- 1
Makefile View File

@ -36,7 +36,7 @@ else
GOOGLE_PERFTOOLS_LDFLAGS=
endif
CFLAGS = -c -I. -I./include $(PORT_CFLAGS) $(PLATFORM_CCFLAGS) $(OPT) $(SNAPPY_CFLAGS)
CFLAGS = -c -I. -I./include $(PORT_CFLAGS) $(PLATFORM_CFLAGS) $(OPT) $(SNAPPY_CFLAGS)
LDFLAGS=$(PLATFORM_LDFLAGS) $(SNAPPY_LDFLAGS) $(GOOGLE_PERFTOOLS_LDFLAGS)
@ -168,6 +168,7 @@ ifeq ($(PLATFORM), IOS)
SIMULATORROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer
DEVICEROOT=/Developer/Platforms/iPhoneOS.platform/Developer
IOSVERSION=$(shell defaults read /Developer/Platforms/iPhoneOS.platform/version CFBundleShortVersionString)
.cc.o:
mkdir -p ios-x86/$(dir $@)
$(SIMULATORROOT)/usr/bin/$(CC) $(CFLAGS) -isysroot $(SIMULATORROOT)/SDKs/iPhoneSimulator$(IOSVERSION).sdk -arch i686 $< -o ios-x86/$@

+ 4
- 4
build_detect_platform View File

@ -17,8 +17,8 @@ rm -f build_config.mk
case `uname -s` in
Darwin)
PLATFORM=OS_MACOSX
echo "PLATFORM_CFLAGS=-pthread -DOS_MACOSX" >> build_config.mk
echo "PLATFORM_LDFLAGS=-lpthread" >> build_config.mk
echo "PLATFORM_CFLAGS=-DOS_MACOSX" >> build_config.mk
echo "PLATFORM_LDFLAGS=" >> build_config.mk
;;
Linux)
PLATFORM=OS_LINUX
@ -49,9 +49,9 @@ g++ $CFLAGS -std=c++0x -x c++ - -o /dev/null 2>/dev/null <
int main() {}
EOF
if [ "$?" = 0 ]; then
PORT_CFLAGS+=" -DLEVELDB_PLATFORM_POSIX -DLEVELDB_CSTDATOMIC_PRESENT -std=c++0x"
PORT_CFLAGS="$PORT_CFLAGS -DLEVELDB_PLATFORM_POSIX -DLEVELDB_CSTDATOMIC_PRESENT -std=c++0x"
else
PORT_CFLAGS+=" -DLEVELDB_PLATFORM_POSIX"
PORT_CFLAGS="$PORT_CFLAGS -DLEVELDB_PLATFORM_POSIX"
fi
# Test whether Snappy library is installed

+ 0
- 50
port/port_osx.cc View File

@ -1,50 +0,0 @@
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#include "port_osx.h"
#include <cstdlib>
#include <stdio.h>
#include <string.h>
#include "util/logging.h"
namespace leveldb {
namespace port {
static void PthreadCall(const char* label, int result) {
if (result != 0) {
fprintf(stderr, "pthread %s: %s\n", label, strerror(result));
abort();
}
}
Mutex::Mutex() { PthreadCall("init mutex", pthread_mutex_init(&mu_, NULL)); }
Mutex::~Mutex() { PthreadCall("destroy mutex", pthread_mutex_destroy(&mu_)); }
void Mutex::Lock() { PthreadCall("lock", pthread_mutex_lock(&mu_)); }
void Mutex::Unlock() { PthreadCall("unlock", pthread_mutex_unlock(&mu_)); }
CondVar::CondVar(Mutex* mu)
: mu_(mu) {
PthreadCall("init cv", pthread_cond_init(&cv_, NULL));
}
CondVar::~CondVar() { PthreadCall("destroy cv", pthread_cond_destroy(&cv_)); }
void CondVar::Wait() {
PthreadCall("wait", pthread_cond_wait(&cv_, &mu_->mu_));
}
void CondVar::Signal() {
PthreadCall("signal", pthread_cond_signal(&cv_));
}
void CondVar::SignalAll() {
PthreadCall("broadcast", pthread_cond_broadcast(&cv_));
}
}
}

+ 0
- 125
port/port_osx.h View File

@ -1,125 +0,0 @@
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
//
// See port_example.h for documentation for the following types/functions.
#ifndef STORAGE_LEVELDB_PORT_PORT_OSX_H_
#define STORAGE_LEVELDB_PORT_PORT_OSX_H_
#include <libkern/OSAtomic.h>
#include <machine/endian.h>
#include <pthread.h>
#include <stdint.h>
#include <string>
namespace leveldb {
// The following 4 methods implemented here for the benefit of env_posix.cc.
inline size_t fread_unlocked(void *a, size_t b, size_t c, FILE *d) {
return fread(a, b, c, d);
}
inline size_t fwrite_unlocked(const void *a, size_t b, size_t c, FILE *d) {
return fwrite(a, b, c, d);
}
inline int fflush_unlocked(FILE *f) {
return fflush(f);
}
inline int fdatasync(int fd) {
return fsync(fd);
}
namespace port {
static const bool kLittleEndian = (__DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN);
// ------------------ Threading -------------------
// A Mutex represents an exclusive lock.
class Mutex {
public:
Mutex();
~Mutex();
void Lock();
void Unlock();
void AssertHeld() { }
private:
friend class CondVar;
pthread_mutex_t mu_;
// No copying
Mutex(const Mutex&);
void operator=(const Mutex&);
};
class CondVar {
public:
explicit CondVar(Mutex* mu);
~CondVar();
void Wait();
void Signal();
void SignalAll();
private:
pthread_cond_t cv_;
Mutex* mu_;
};
inline void MemoryBarrier() {
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
// See http://gcc.gnu.org/ml/gcc/2003-04/msg01180.html for a discussion on
// this idiom. Also see http://en.wikipedia.org/wiki/Memory_ordering.
__asm__ __volatile__("" : : : "memory");
#else
OSMemoryBarrier();
#endif
}
class AtomicPointer {
private:
void* ptr_;
public:
AtomicPointer() { }
explicit AtomicPointer(void* p) : ptr_(p) {}
inline void* Acquire_Load() const {
void* ptr = ptr_;
MemoryBarrier();
return ptr;
}
inline void Release_Store(void* v) {
MemoryBarrier();
ptr_ = v;
}
inline void* NoBarrier_Load() const {
return ptr_;
}
inline void NoBarrier_Store(void* v) {
ptr_ = v;
}
};
inline bool Snappy_Compress(const char* input, size_t input_length,
std::string* output) {
return false;
}
inline bool Snappy_Uncompress(const char* input_data, size_t input_length,
std::string* output) {
return false;
}
inline bool GetHeapProfile(void (*func)(void*, const char*, int), void* arg) {
return false;
}
}
}
#endif // STORAGE_LEVELDB_PORT_PORT_OSX_H_

Loading…
Cancel
Save