Permalink
Browse files

Add basic files for building common-c

  • Loading branch information...
1 parent 695d7bd commit 212de9a3a887a4b202102bbd3e2b0ae890e39cc6 @cgutman cgutman committed Feb 13, 2016
Showing with 78 additions and 0 deletions.
  1. +30 −0 Makefile
  2. +29 −0 common-c.mk
  3. +18 −0 libchelper.c
  4. +1 −0 make.bat
View
@@ -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),))
View
@@ -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)
View
@@ -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;
+}
View
@@ -0,0 +1 @@
+@%NACL_SDK_ROOT%\tools\make.exe %*

0 comments on commit 212de9a

Please sign in to comment.