diff --git a/c/Makefile b/c/Makefile index 7521944..874933e 100644 --- a/c/Makefile +++ b/c/Makefile @@ -29,7 +29,7 @@ # - CFLAGS: Any extra user-specified compiler flags (can be blank). # Recommended compiler flags: -CFLAGS ?= -std=c99 -O +CFLAGS += -std=c99 # Extra flags for diagnostics: # CFLAGS += -g -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -fsanitize=undefined,address @@ -63,8 +63,9 @@ LIBOBJ = qrcodegen.o MAINS = qrcodegen-demo qrcodegen-test qrcodegen-worker # define paths to install -INCLUDEDIR ?= $(DESTDIR)/usr/include/qrcodegen -LIBDIR ?= $(DESTDIR)/usr/lib +PREFIX ?= /usr/local +INCLUDEDIR ?= $(DESTDIR)$(PREFIX)/include/qrcodegen +LIBDIR ?= $(DESTDIR)$(PREFIX)/lib # Build all binaries all: $(LIBFILE) $(ARFILE) $(MAINS) @@ -105,7 +106,7 @@ $(ARFILE): $(LIBOBJ) $(AR) -crs $@ -- $^ $(LIBFILE): $(LIBOBJ) - $(CC) -shared -Wl,-soname,$(SO_NAME) $(LDFLAGS) -o $@ $^ + $(CC) $(CFLAGS) -shared -Wl,-soname,$(SO_NAME) $(LDFLAGS) -o $@ $^ # Object files %.o: %.c .deps/timestamp diff --git a/cpp/Makefile b/cpp/Makefile index 42fa4ff..f8d9b7f 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -29,7 +29,7 @@ # - CXXFLAGS: Any extra user-specified compiler flags (can be blank). # Recommended compiler flags: -CXXFLAGS ?= -std=c++11 -O +CXXFLAGS += -std=c++11 # Extra flags for diagnostics: # CXXFLAGS += -g -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -fsanitize=undefined,address @@ -63,8 +63,9 @@ LIBOBJ = QrCode.o MAINS = QrCodeGeneratorDemo QrCodeGeneratorWorker # define paths to install -INCLUDEDIR ?= $(DESTDIR)/usr/include/qrcodegen -LIBDIR ?= $(DESTDIR)/usr/lib +PREFIX ?= /usr/local +INCLUDEDIR ?= $(DESTDIR)$(PREFIX)/include/qrcodegen +LIBDIR ?= $(DESTDIR)$(PREFIX)/lib # Build all binaries @@ -102,7 +103,7 @@ $(ARFILE): $(LIBOBJ) $(AR) -crs $@ -- $^ $(LIBFILE): $(LIBOBJ) - $(CC) -shared -Wl,-soname,$(SO_NAME) $(LDFLAGS) -o $@ $^ + $(CXX) $(CXXFLAGS) -shared -Wl,-soname,$(SO_NAME) $(LDFLAGS) -o $@ $^ # Object files %.o: %.cpp .deps/timestamp