Add basic files for building common-c

This commit is contained in:
Cameron Gutman 2016-02-12 21:44:00 -05:00
parent 695d7bd345
commit 212de9a3a8
4 changed files with 78 additions and 0 deletions

30
Makefile Normal file
View File

@ -0,0 +1,30 @@
VALID_TOOLCHAINS := newlib pnacl
TARGET = moonlight-chrome
include $(NACL_SDK_ROOT)/tools/common.mk
# Include Moonlight-Common-C makefile
include common-c.mk
LIBS = ppapi pthread
CFLAGS = -Wall -Wno-missing-braces
SOURCES = \
$(COMMON_C_SOURCE) \
libchelper.c \
# Build rules generated by macros from common.mk:
$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS))))
# The PNaCl workflow uses both an unstripped and finalized/stripped binary.
# On NaCl, only produce a stripped binary for Release configs (not Debug).
ifneq (,$(or $(findstring pnacl,$(TOOLCHAIN)),$(findstring Release,$(CONFIG))))
$(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS)))
$(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped))
else
$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS)))
endif
$(eval $(call NMF_RULE,$(TARGET),))

29
common-c.mk Normal file
View File

@ -0,0 +1,29 @@
COMMON_C_DIR := moonlight-common-c/limelight-common
OPENAES_DIR := $(COMMON_C_DIR)/OpenAES
OPENAES_SOURCE := \
$(OPENAES_DIR)/oaes_base64.c \
$(OPENAES_DIR)/oaes_lib.c \
OPENAES_INCLUDE := $(OPENAES_DIR)
COMMON_C_SOURCE := \
$(COMMON_C_DIR)/AudioStream.c \
$(COMMON_C_DIR)/ByteBuffer.c \
$(COMMON_C_DIR)/Connection.c \
$(COMMON_C_DIR)/ControlStream.c \
$(COMMON_C_DIR)/FakeCallbacks.c \
$(COMMON_C_DIR)/InputStream.c \
$(COMMON_C_DIR)/LinkedBlockingQueue.c \
$(COMMON_C_DIR)/Misc.c \
$(COMMON_C_DIR)/Platform.c \
$(COMMON_C_DIR)/PlatformSockets.c \
$(COMMON_C_DIR)/RtpReorderQueue.c \
$(COMMON_C_DIR)/RtspConnection.c \
$(COMMON_C_DIR)/RtspParser.c \
$(COMMON_C_DIR)/SdpGenerator.c \
$(COMMON_C_DIR)/VideoDepacketizer.c \
$(COMMON_C_DIR)/VideoStream.c \
$(OPENAES_SOURCE) \
COMMON_C_INCLUDE := $(COMMON_C_DIR) $(OPENAES_INCLUDE)

18
libchelper.c Normal file
View File

@ -0,0 +1,18 @@
#include <sys/timeb.h>
#include <sys/time.h>
// This function is defined but not implemented by newlib
int ftime(struct timeb *tp) {
struct timeval tv;
if (gettimeofday(&tv, NULL) < 0) {
return -1;
}
tp->time = tv.tv_sec;
tp->millitm = tv.tv_usec / 1000;
tp->timezone = 0;
tp->dstflag = 0;
return 0;
}

1
make.bat Normal file
View File

@ -0,0 +1 @@
@%NACL_SDK_ROOT%\tools\make.exe %*