--- a/Makefile
+++ b/Makefile
@@ -4,14 +4,14 @@
default: build/debug/mujs build/debug/mujs-pp
-CFLAGS = -std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter
+CFLAGS += -std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter
OPTIM = -O3
-prefix = /usr/local
-bindir = $(prefix)/bin
-incdir = $(prefix)/include
-libdir = $(prefix)/lib
+prefix ?= /usr/local
+bindir ?= $(prefix)/bin
+incdir ?= $(prefix)/include
+libdir ?= $(prefix)/lib
ifeq ($(wildcard .git),.git)
VERSION = $(shell git describe --tags --always)
@@ -97,16 +97,16 @@ build/debug/mujs-pp: pp.c build/debug/li
build/release/libmujs.$(SO): one.c $(SRCS) $(HDRS)
@mkdir -p $(@D)
- $(CC) $(CFLAGS) $(OPTIM) -fPIC -shared -o $@ one.c -lm
+ $(CC) $(CFLAGS) $(OPTIM) -fPIC -shared -o $@ one.c -lm $(LDFLAGS)
build/release/libmujs.o: one.c $(SRCS) $(HDRS)
@mkdir -p $(@D)
$(CC) $(CFLAGS) $(OPTIM) -c -o $@ one.c
build/release/libmujs.a: build/release/libmujs.o
$(AR) cr $@ $^
build/release/mujs: main.c build/release/libmujs.o
- $(CC) $(CFLAGS) $(OPTIM) -o $@ $^ -lm $(READLINE_CFLAGS) $(READLINE_LIBS)
+ $(CC) $(CFLAGS) $(OPTIM) -o $@ $^ -lm $(READLINE_CFLAGS) $(READLINE_LIBS) $(LDFLAGS)
build/release/mujs-pp: pp.c build/release/libmujs.o
- $(CC) $(CFLAGS) $(OPTIM) -o $@ $^ -lm
+ $(CC) $(CFLAGS) $(OPTIM) -o $@ $^ -lm $(LDFLAGS)
build/release/mujs.pc:
@mkdir -p $(@D)