[Pkg-mozext-commits] [adblock-plus] 103/464: Generalize Makefile to work on Windows
David Prévot
taffit at moszumanska.debian.org
Tue Jul 22 20:44:07 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit 802a7ac35f596932e8df14d29a4f486f9fef05c6
Author: Wladimir Palant <trev at adblockplus.org>
Date: Thu Dec 2 20:05:00 2010 +0100
Generalize Makefile to work on Windows
---
Makefile | 20 ++++++++++++--------
jshydra_bridge.cpp | 2 ++
jshydra_funcs.cpp | 3 ++-
3 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile
index 6561024..9ac8c3d 100644
--- a/Makefile
+++ b/Makefile
@@ -11,26 +11,30 @@ include $(MOZ_SRCDIR)/js/src/config/config.mk
LINK := -L$(MOZ_OBJDIR)/dist/lib -lnspr4 -lm
-jshydra: jshydra.o jshydra_funcs.o jshydra_bridge.o
- g++ -o $@ $^ $(MOZ_OBJDIR)/js/src/libjs_static.a $(LINK)
+jshydra$(BIN_SUFFIX): jshydra.$(OBJ_SUFFIX) jshydra_funcs.$(OBJ_SUFFIX) jshydra_bridge.$(OBJ_SUFFIX) $(MOZ_OBJDIR)/js/src/$(LIB_PREFIX)js_static.$(LIB_SUFFIX)
+ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
+ $(LD) -nologo -out:$@ $^ $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
+else
+ g++ -o $@ $^ $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
+endif
.deps:
@if [ ! -e .deps ]; then mkdir .deps; fi
-%.o: %.cpp .deps $(MOZ_OBJDIR)/js/src/libjs_static.a
+%.$(OBJ_SUFFIX): %.cpp .deps $(MOZ_OBJDIR)/js/src/$(LIB_PREFIX)js_static.$(LIB_SUFFIX)
$(CXX) -o $@ -c $(COMPILE_CXXFLAGS) $<
clean:
- @rm -rf jshydra *.o .deps
+ @rm -rf jshydra$(BIN_SUFFIX) *.$(OBJ_SUFFIX) *.$(LIB_SUFFIX) .deps
-include $(wildcard .deps/*.pp)
TESTS := $(notdir $(wildcard autotest/test_*.js))
-check:: jshydra
+check:: jshydra$(BIN_SUFFIX)
@cd autotest && for f in $(TESTS); do \
eval $$(cat $$f | sed -e '/^\/\/ [A-Za-z]*:/!q' -e 's+^// \([A-Za-z]*\): \(.*\)$$+export \1="\2"+'); \
echo -n "$$Name... "; \
- ../jshydra $$f $$Arguments &> .$$f.out; \
+ ../jshydra$(BIN_SUFFIX) $$f $$Arguments &> .$$f.out; \
if diff -q ".$$f.out" "$$f.expected" &>/dev/null; then \
echo ' passed!'; \
else \
@@ -44,12 +48,12 @@ check:: jshydra
echo-variable-%:
@echo "$($*)"
-full-check:: jshydra
+full-check:: jshydra$(BIN_SUFFIX)
@cp -R $(MOZ_SRCDIR)/js/src/tests jstest
@echo "Decompiling JS ASTs.."
set -e; \
for f in $$(find jstest -name '*.js'); do \
echo $$f; \
- ./jshydra scripts/decompile.js "$(MOZ_SRCDIR)/js/src/tests$${f#jstest}" >$$f; \
+ ./jshydra$(BIN_SUFFIX) scripts/decompile.js "$(MOZ_SRCDIR)/js/src/tests$${f#jstest}" >$$f; \
done
#python jstest/jstests.py --tinderbox fake_js.sh
diff --git a/jshydra_bridge.cpp b/jshydra_bridge.cpp
index 3cebab0..4067e7b 100644
--- a/jshydra_bridge.cpp
+++ b/jshydra_bridge.cpp
@@ -1,6 +1,8 @@
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
#include "jsapi.h"
+#ifndef XP_WIN
#include <unistd.h>
+#endif // XP_WIN
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/jshydra_funcs.cpp b/jshydra_funcs.cpp
index d60e160..d5c87fd 100644
--- a/jshydra_funcs.cpp
+++ b/jshydra_funcs.cpp
@@ -5,6 +5,7 @@
#include <stdlib.h>
#include "jsapi.h"
+#include "jsprf.h"
#include "jshydra_funcs.h"
#include "jshydra_bridge.h"
@@ -290,7 +291,7 @@ JSBool Hashcode(JSContext *cx, JSObject *obj_this, uintN argc,
static int counter = 0;
char str[256];
jsval val;
- snprintf (str, sizeof (str), "%x", ++counter);
+ JS_snprintf (str, sizeof (str), "%x", ++counter);
val = STRING_TO_JSVAL (JS_NewStringCopyZ (cx, str));
JS_DefineProperty (cx, obj, "_hashcode", val,
NULL, NULL, JSPROP_PERMANENT | JSPROP_READONLY);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list