1 diff -up QR-Code-generator-13a25580a3e2a29b2b6653802d58d39056f3eaf2/c/Makefile.1~ QR-Code-generator-13a25580a3e2a29b2b6653802d58d39056f3eaf2/c/Makefile
2 --- QR-Code-generator-13a25580a3e2a29b2b6653802d58d39056f3eaf2/c/Makefile.1~ 2020-01-29 18:52:21.000000000 +0100
3 +++ QR-Code-generator-13a25580a3e2a29b2b6653802d58d39056f3eaf2/c/Makefile 2020-03-02 05:14:45.909539003 +0100
4 @@ -29,11 +29,13 @@
5 # - CFLAGS: Any extra user-specified compiler flags (can be blank).
6
7 # Recommended compiler flags:
8 -CFLAGS += -std=c99 -O
9 +CFLAGS += -std=c99
10
11 # Extra flags for diagnostics:
12 # CFLAGS += -g -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -fsanitize=undefined,address
13
14 +# Version information
15 +VERSION = 1.5.0
16
17 # ---- Controlling make ----
18
19 @@ -51,10 +53,18 @@ CFLAGS += -std=c99 -O
20 # ---- Targets to build ----
21
22 LIB = qrcodegen
23 -LIBFILE = lib$(LIB).a
24 +LIBFILE = lib$(LIB).so
25 +# Bump the soname number when the ABI changes and gets incompatible
26 +SO_NAME = $(LIBFILE).1
27 +REAL_NAME = $(LIBFILE).$(VERSION)
28 +HEADERS = qrcodegen.h
29 LIBOBJ = qrcodegen.o
30 MAINS = qrcodegen-demo qrcodegen-test qrcodegen-worker
31
32 +# define paths to install
33 +INCLUDEDIR ?= $(DESTDIR)/usr/include/qrcodegen
34 +LIBDIR ?= $(DESTDIR)/usr/lib
35 +
36 # Build all binaries
37 all: $(LIBFILE) $(MAINS)
38
39 @@ -63,6 +73,18 @@ clean:
40 rm -f -- $(LIBOBJ) $(LIBFILE) $(MAINS:=.o) $(MAINS)
41 rm -rf .deps
42
43 +install-shared: $(LIBFILE)
44 + install -d $(LIBDIR) || true
45 + install -m 0755 $(LIBFILE) $(LIBDIR)/$(REAL_NAME)
46 + ln -s $(REAL_NAME) $(LIBDIR)/$(SO_NAME)
47 + ln -s $(SO_NAME) $(LIBDIR)/$(LIBFILE)
48 +
49 +install-header: $(HEADERS)
50 + install -d $(INCLUDEDIR) || true
51 + install -m 0644 $(HEADERS) $(INCLUDEDIR)/
52 +
53 +install: install-shared install-header
54 +
55 # Executable files
56 %: %.o $(LIBFILE)
57 $(CC) $(CFLAGS) -o $@ $< -L . -l $(LIB)
58 @@ -73,11 +95,11 @@ qrcodegen-test: qrcodegen-test.c $(LIBOB
59
60 # The library
61 $(LIBFILE): $(LIBOBJ)
62 - $(AR) -crs $@ -- $^
63 + $(CC) $(CXXFLAGS) -shared -Wl,-soname,$(SO_NAME) $(LDFLAGS) -o $@ $^
64
65 # Object files
66 %.o: %.c .deps/timestamp
67 - $(CC) $(CFLAGS) -c -o $@ -MMD -MF .deps/$*.d $<
68 + $(CC) $(CFLAGS) -fPIC -c -o $@ -MMD -MF .deps/$*.d $<
69
70 # Have a place to store header dependencies automatically generated by compiler
71 .deps/timestamp:
72 diff -up QR-Code-generator-13a25580a3e2a29b2b6653802d58d39056f3eaf2/cpp/Makefile.1~ QR-Code-generator-13a25580a3e2a29b2b6653802d58d39056f3eaf2/cpp/Makefile
73 --- QR-Code-generator-13a25580a3e2a29b2b6653802d58d39056f3eaf2/cpp/Makefile.1~ 2020-01-29 18:52:21.000000000 +0100
74 +++ QR-Code-generator-13a25580a3e2a29b2b6653802d58d39056f3eaf2/cpp/Makefile 2020-03-02 05:15:35.901541207 +0100
75 @@ -29,11 +29,13 @@
76 # - CXXFLAGS: Any extra user-specified compiler flags (can be blank).
77
78 # Recommended compiler flags:
79 -CXXFLAGS += -std=c++11 -O
80 +CXXFLAGS += -std=c++11
81
82 # Extra flags for diagnostics:
83 # CXXFLAGS += -g -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -fsanitize=undefined,address
84
85 +# Version information
86 +VERSION = 1.5.0
87
88 # ---- Controlling make ----
89
90 @@ -50,11 +52,19 @@ CXXFLAGS += -std=c++11 -O
91
92 # ---- Targets to build ----
93
94 -LIB = qrcodegen
95 -LIBFILE = lib$(LIB).a
96 +LIB = qrcodegencpp
97 +LIBFILE = lib$(LIB).so
98 +# Bump the soname number when the ABI changes and gets incompatible
99 +SO_NAME = $(LIBFILE).1
100 +REAL_NAME = $(LIBFILE).$(VERSION)
101 +HEADERS = QrCode.hpp
102 LIBOBJ = QrCode.o
103 MAINS = QrCodeGeneratorDemo QrCodeGeneratorWorker
104
105 +# define paths to install
106 +INCLUDEDIR ?= $(DESTDIR)/usr/include/qrcodegen
107 +LIBDIR ?= $(DESTDIR)/usr/lib
108 +
109 # Build all binaries
110 all: $(LIBFILE) $(MAINS)
111
112 @@ -63,17 +73,29 @@ clean:
113 rm -f -- $(LIBOBJ) $(LIBFILE) $(MAINS:=.o) $(MAINS)
114 rm -rf .deps
115
116 +install-shared: $(LIBFILE)
117 + install -d $(LIBDIR) || true
118 + install -m 0755 $(LIBFILE) $(LIBDIR)/$(REAL_NAME)
119 + ln -s $(REAL_NAME) $(LIBDIR)/$(SO_NAME)
120 + ln -s $(SO_NAME) $(LIBDIR)/$(LIBFILE)
121 +
122 +install-header: $(HEADERS)
123 + install -d $(INCLUDEDIR) || true
124 + install -m 0644 $(HEADERS) $(INCLUDEDIR)/
125 +
126 +install: install-shared install-header
127 +
128 # Executable files
129 %: %.o $(LIBFILE)
130 $(CXX) $(CXXFLAGS) -o $@ $< -L . -l $(LIB)
131
132 # The library
133 $(LIBFILE): $(LIBOBJ)
134 - $(AR) -crs $@ -- $^
135 + $(CXX) $(CXXFLAGS) -shared -Wl,-soname,$(SO_NAME) $(LDFLAGS) -o $@ $^
136
137 # Object files
138 %.o: %.cpp .deps/timestamp
139 - $(CXX) $(CXXFLAGS) -c -o $@ -MMD -MF .deps/$*.d $<
140 + $(CXX) $(CXXFLAGS) -fPIC -c -o $@ -MMD -MF .deps/$*.d $<
141
142 # Have a place to store header dependencies automatically generated by compiler
143 .deps/timestamp:
|