shithub: libmujs

Download patch

ref: 80e222d91d4438f111237873c7910b4c0eacb749
parent: 368fe83737062f1004db942f3d4c7a170bc86725
author: Tor Andersson <tor.andersson@artifex.com>
date: Thu Feb 4 04:56:34 EST 2021

Support externally set CFLAGS, CPPFLAGS, and LDFLAGS.

--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@
 
 # Compiler flags for various configurations:
 
-CFLAGS := -std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter
+CFLAGS += -std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter
 
 ifeq "$(CC)" "clang"
   CFLAGS += -Wunreachable-code
@@ -30,7 +30,7 @@
 else ifeq "$(build)" "sanitize"
   CFLAGS += -pipe -g -fsanitize=address -fno-omit-frame-pointer
   LDFLAGS += -fsanitize=address
-else
+else ifeq "$(build)" "release"
   CFLAGS += -Os
   LDFLAGS += -Wl,-s
 endif
@@ -67,11 +67,11 @@
 
 $(OUT)/%.o: %.c $(HDRS)
 	@ mkdir -p $(dir $@)
-	$(CC) $(CFLAGS) -o $@ -c $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
 
 $(OUT)/libmujs.o: one.c $(HDRS)
 	@ mkdir -p $(dir $@)
-	$(CC) $(CFLAGS) -o $@ -c $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
 
 $(OUT)/libmujs.a: $(OUT)/libmujs.o
 	@ mkdir -p $(dir $@)
@@ -79,7 +79,7 @@
 
 $(OUT)/libmujs.so: one.c $(HDRS)
 	@ mkdir -p $(dir $@)
-	$(CC) $(CFLAGS) -fPIC -shared -o $@ $< -lm
+	$(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -shared $(LDFLAGS) -o $@ $< -lm
 
 $(OUT)/mujs: $(OUT)/libmujs.o $(OUT)/main.o
 	@ mkdir -p $(dir $@)