Skip to content

Commit

Permalink
added mac support
Browse files Browse the repository at this point in the history
  • Loading branch information
c-bik committed Apr 7, 2015
1 parent c972416 commit aabf37b
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 2 deletions.
49 changes: 49 additions & 0 deletions c_src/Makefile.osx
@@ -0,0 +1,49 @@
EXE_TARGET = ocierl
LIB_TARGET = liberloci.a

ifeq "$(wildcard c_src)" ""
SRC_PATH_PREFIX =
PRIV_DIR = ../priv
else
SRC_PATH_PREFIX = c_src/
PRIV_DIR = priv
endif

ERLOCI_PATH = $(SRC_PATH_PREFIX)erloci_drv
ERLOCI_LIB_PATH = $(SRC_PATH_PREFIX)erloci_lib
OCI_INCLUDE_PATH = $(INSTANT_CLIENT_INCLUDE_PATH)
OCI_LIB_PATH = $(INSTANT_CLIENT_LIB_PATH)

ERLOCI_LIB_HDRS = $(wildcard $(addprefix $(ERLOCI_LIB_PATH)/, *.h))
ERLOCI_LIB_SRCS = $(wildcard $(addprefix $(ERLOCI_LIB_PATH)/, *.cpp))
ERLOCI_LIB_OBJS = $(ERLOCI_LIB_SRCS:.cpp=.o)

ERLOCI_HDRS = $(wildcard $(addprefix $(ERLOCI_PATH)/, *.h))
ERLOCI_SRCS = $(wildcard $(addprefix $(ERLOCI_PATH)/, *.cpp))
ERLOCI_OBJS = $(ERLOCI_SRCS:.cpp=.o)

CXXFLAGS = -ggdb -Wall -I$(ERL_INTERFACE_DIR)/include -I$(ERLOCI_PATH) -I$(ERLOCI_LIB_PATH) -I$(OCI_INCLUDE_PATH)
LINKDIRS = -L$(ERL_INTERFACE_DIR)/lib -L$(PRIV_DIR) -L$(OCI_LIB_PATH)
#LINKFLAGS = -levent -lpthread -lerl_interface -lei -lerloci -locci -lons -lclntshcore -lclntsh -lnnz12 -lipc1 -lmql1
LINKFLAGS = -levent -lpthread -lerl_interface -lei -lerloci -locci -lclntsh -lnnz11
all: $(PRIV_DIR)/$(EXE_TARGET)
@echo "erloci compiled!!!"

$(PRIV_DIR)/$(EXE_TARGET): $(PRIV_DIR)/$(LIB_TARGET) $(ERLOCI_OBJS)
g++ -Wall $(LINKDIRS) $^ $(LINKFLAGS) -o $@

$(PRIV_DIR)/$(LIB_TARGET): $(ERLOCI_LIB_OBJS)
ar rcs $(PRIV_DIR)/$(LIB_TARGET) $(ERLOCI_LIB_OBJS)

$(ERLOCI_LIB_SRCS): $(ERLOCI_LIB_HDRS)
touch $(ERLOCI_LIB_SRCS)

$(ERLOCI_SRCS): $(ERLOCI_HDRS) $(ERLOCI_LIB_HDRS)
touch $(ERLOCI_LIB_SRCS)
touch $(ERLOCI_SRCS)

clean:
rm -rf $(ERLOCI_OBJS)
rm -rf $(ERLOCI_LIB_OBJS)
rm -rf $(PRIV_DIR)/$(LIB_TARGET)
rm -rf $(PRIV_DIR)/$(EXE_TARGET)
4 changes: 4 additions & 0 deletions c_src/erloci_drv/threads.cpp
Expand Up @@ -177,8 +177,12 @@ ProcessCommandCb (
break;
Sleep(end - start);
}
#ifdef __APPLE__
pthread_yield_np();
#else
pthread_yield();
#endif
#else
usleep(50000);
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions rebar.config
Expand Up @@ -7,6 +7,6 @@
{"win32", clean, "nmake /F c_src/Makefile.mak clean conf=Debug"},
{"linux", compile, "make -f c_src/Makefile"},
{"linux", clean, "make -f c_src/Makefile clean"},
{"darwin", compile, "make -f c_src/Makefile"},
{"darwin", clean, "make -f c_src/Makefile clean"}
{"darwin", compile, "make -f c_src/Makefile.osx"},
{"darwin", clean, "make -f c_src/Makefile.osx clean"}
]}.

0 comments on commit aabf37b

Please sign in to comment.