shithub: libmujs

Download patch

ref: 9bc5fec0804381d59ef8dc62304ed6892fb7c4ca
parent: 031513b25b73ce5e5fc7d6bafd512a822d8ded76
author: Tor Andersson <tor.andersson@artifex.com>
date: Thu Dec 11 11:45:04 EST 2014

Fix makefile issues.

Don't force use of clang.
Use POSIX compatible grep and sed syntax.
Use POSIX compatible install arguments.

--- a/Makefile
+++ b/Makefile
@@ -7,9 +7,12 @@
 incdir ?= $(prefix)/include
 libdir ?= $(prefix)/lib
 
-CC := clang
-CFLAGS := -std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter -Wunreachable-code
+CFLAGS := -std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter
 
+ifeq "$(CC)" "clang"
+CFLAGS += -Wunreachable-code
+endif
+
 ifeq "$(build)" "debug"
 CFLAGS += -g
 else
@@ -25,10 +28,10 @@
 	$(MAKE) build=release
 
 astnames.h: jsparse.h
-	grep '\(AST\|EXP\|STM\)_' jsparse.h | sed 's/^[ \t]*\(AST_\)\?/"/;s/,.*/",/' | tr A-Z a-z > $@
+	grep -E '(AST|EXP|STM)_' jsparse.h | sed 's/^[^A-Z]*\(AST_\)*/"/;s/,.*/",/' | tr A-Z a-z > $@
 
 opnames.h: jscompile.h
-	grep 'OP_' jscompile.h | sed 's/^[ \t]*OP_/"/;s/,.*/",/' | tr A-Z a-z > $@
+	grep -E 'OP_' jscompile.h | sed 's/^[^A-Z]*OP_/"/;s/,.*/",/' | tr A-Z a-z > $@
 
 one.c: $(SRCS)
 	ls $(SRCS) | awk '{print "#include \""$$1"\""}' > $@
@@ -42,7 +45,7 @@
 	$(CC) $(CFLAGS) -o $@ -c $<
 
 build/libmujs.a: $(OBJS)
-	ar cru $@ $^
+	$(AR) cru $@ $^
 
 build/mujs: build/main.o build/libmujs.a
 	$(CC) $(LDFLAGS) -o $@ $^ -lm
@@ -54,9 +57,9 @@
 	install -d $(DESTDIR)$(incdir)
 	install -d $(DESTDIR)$(libdir)
 	install -d $(DESTDIR)$(bindir)
-	install -t $(DESTDIR)$(incdir) mujs.h
-	install -t $(DESTDIR)$(libdir) build/libmujs.a
-	install -t $(DESTDIR)$(bindir) build/mujs
+	install mujs.h $(DESTDIR)$(incdir)
+	install build/libmujs.a $(DESTDIR)$(libdir)
+	install build/mujs $(DESTDIR)$(bindir)
 
 VERSION = $(shell git describe --tags --always)