Stefan Schuermans commited on 2019-05-30 18:28:57
Showing 34 changed files, with 278 additions and 292 deletions.
join makefiles, parallel build is now supported, rpaths of binaries are fixed
... | ... |
@@ -1,137 +0,0 @@ |
1 |
-# BlinkenLib |
|
2 |
-# Copyright 2004-2016 Stefan Schuermans <stefan@schuermans.info> |
|
3 |
-# Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html |
|
4 |
-# a blinkenarea.org project |
|
5 |
- |
|
6 |
-CC:=gcc |
|
7 |
-CFLAGS:=-Wall -Wextra -Werror -fPIC -O2 -I.. |
|
8 |
-LIB_LDFLAGS:= |
|
9 |
-LIB_LDLIBS:= |
|
10 |
-BIN_LDFLAGS:=-L. |
|
11 |
-BIN_LDLIBS:= |
|
12 |
-AR:=ar |
|
13 |
-RANLIB:=ranlib |
|
14 |
- |
|
15 |
--include ../version.mk |
|
16 |
--include ../config/config.mk |
|
17 |
- |
|
18 |
-LIB_OBJS:=BlinkenColorizer.o BlinkenFrame.o BlinkenMovie.o \ |
|
19 |
- BlinkenProto.o Tools.o |
|
20 |
- |
|
21 |
-ifeq ($(BLINKENLIB_CFG_MNG),1) |
|
22 |
-LIB_OBJS+=BlinkenMng.o |
|
23 |
-LIB_LDLIBS+=-lmng -lz |
|
24 |
-endif |
|
25 |
- |
|
26 |
-ifeq ($(BLINKENLIB_CFG_GIF),1) |
|
27 |
-LIB_OBJS+=BlinkenGif.o |
|
28 |
-LIB_LDLIBS+=-lgif |
|
29 |
-endif |
|
30 |
- |
|
31 |
-ifeq ($(BLINKENLIB_CFG_WIN),1) |
|
32 |
-SHLIBEXT:=dll |
|
33 |
-LIB_LDLIBS+=-lws2_32 |
|
34 |
-BIN_LDLIBS+=-lws2_32 |
|
35 |
-else |
|
36 |
-ifeq ($(BLINKENLIB_CFG_OSX),1) |
|
37 |
-CFLAGS+=-I/sw/include |
|
38 |
-SHLIBEXT:=dylib |
|
39 |
-LIB_LDFLAGS+=-L/sw/lib |
|
40 |
-BIN_LDFLAGS+=-L/sw/lib -Wl,-rpath,'$$ORIGIN' |
|
41 |
-else |
|
42 |
-SHLIBEXT:=so |
|
43 |
-LIB_LDFLAGS+=-Wl,-soname,libBlinkenLib.$(SHLIBEXT).$(VERSION_MAJOR) |
|
44 |
-BIN_LDFLAGS+=-Wl,-rpath,'$$ORIGIN' |
|
45 |
-endif |
|
46 |
-endif |
|
47 |
- |
|
48 |
-.PHONY: all clean |
|
49 |
-.SUFFIXES: |
|
50 |
-SUFFIXES:= |
|
51 |
-.SECONDARY: |
|
52 |
- |
|
53 |
-all: libBlinkenLib.a \ |
|
54 |
- libBlinkenLib.$(SHLIBEXT).$(VERSION_MAJOR) \ |
|
55 |
- libBlinkenLib.$(SHLIBEXT).$(VERSION) libBlinkenLib.$(SHLIBEXT) |
|
56 |
- |
|
57 |
-all: BlinkenConv BlinkenSend BlinkenRecv |
|
58 |
- |
|
59 |
-ifeq ($(BLINKENLIB_CFG_WIN),0) |
|
60 |
-all: BlinkenOutput BlinkenDeviceOutput |
|
61 |
-endif |
|
62 |
- |
|
63 |
-config.h: ../config/config.h |
|
64 |
- cp $< $@ |
|
65 |
- |
|
66 |
-BlinkenColorizer.o: BlinkenColorizer.c BlinkenColorizer.h Tools.h |
|
67 |
- $(CC) $(CFLAGS) -c -o $@ $< |
|
68 |
- |
|
69 |
-BlinkenProto.o: BlinkenProto.c BlinkenProto.h BlinkenProtoIntern.h |
|
70 |
- $(CC) $(CFLAGS) -c -o $@ $< |
|
71 |
- |
|
72 |
-BlinkenFrame.o: BlinkenFrame.c BlinkenConstants.h BlinkenColorizer.h BlinkenFrame.h BlinkenProto.h BlinkenProtoIntern.h Tools.h |
|
73 |
- $(CC) $(CFLAGS) -c -o $@ $< |
|
74 |
- |
|
75 |
-BlinkenGif.o: BlinkenGif.c BlinkenConstants.h BlinkenColorizer.h BlinkenFrame.h BlinkenProto.h BlinkenMovie.h Tools.h config.h |
|
76 |
- $(CC) $(CFLAGS) -c -o $@ $< |
|
77 |
- |
|
78 |
-BlinkenMovie.o: BlinkenMovie.c BlinkenConstants.h BlinkenColorizer.h BlinkenFrame.h BlinkenProto.h BlinkenMovie.h BlinkenGif.h BlinkenMng.h Tools.h config.h |
|
79 |
- $(CC) $(CFLAGS) -c -o $@ $< |
|
80 |
- |
|
81 |
-BlinkenMng.o: BlinkenMng.c BlinkenConstants.h BlinkenColorizer.h BlinkenFrame.h BlinkenProto.h BlinkenMovie.h Tools.h config.h |
|
82 |
- $(CC) $(CFLAGS) -c -o $@ $< |
|
83 |
- |
|
84 |
-Tools.o: Tools.c Tools.h |
|
85 |
- $(CC) $(CFLAGS) -c -o $@ $< |
|
86 |
- |
|
87 |
-libBlinkenLib.a: $(LIB_OBJS) |
|
88 |
- $(AR) cr $@ $+ |
|
89 |
- $(RANLIB) $@ |
|
90 |
- |
|
91 |
-libBlinkenLib.$(SHLIBEXT).$(VERSION): $(LIB_OBJS) |
|
92 |
- $(CC) -shared $(LIB_LDFLAGS) -o $@ $+ $(LIB_LDLIBS) |
|
93 |
- |
|
94 |
-libBlinkenLib.$(SHLIBEXT).$(VERSION_MAJOR): libBlinkenLib.$(SHLIBEXT).$(VERSION) |
|
95 |
- rm -f $@ |
|
96 |
- ln -s $< $@ |
|
97 |
- |
|
98 |
-libBlinkenLib.$(SHLIBEXT): libBlinkenLib.$(SHLIBEXT).$(VERSION_MAJOR) |
|
99 |
- rm -f $@ |
|
100 |
- ln -s $< $@ |
|
101 |
- |
|
102 |
-Tools2.o: Tools2.c Tools2.h |
|
103 |
- $(CC) $(CFLAGS) -c -o $@ $< |
|
104 |
- |
|
105 |
-BlinkenConv.o: BlinkenConv.c BlinkenLib.h config.h BlinkenColorizer.h BlinkenProto.h BlinkenFrame.h BlinkenMovie.h |
|
106 |
- $(CC) $(CFLAGS) -c -o $@ $< |
|
107 |
- |
|
108 |
-BlinkenConv: BlinkenConv.o libBlinkenLib.$(SHLIBEXT) |
|
109 |
- $(CC) $(BIN_LDFLAGS) -o $@ $< -lBlinkenLib $(BIN_LDLIBS) |
|
110 |
- |
|
111 |
-BlinkenSend.o: BlinkenSend.c BlinkenLib.h config.h BlinkenColorizer.h BlinkenProto.h BlinkenFrame.h BlinkenMovie.h Tools2.h |
|
112 |
- $(CC) $(CFLAGS) -c -o $@ $< |
|
113 |
- |
|
114 |
-BlinkenSend: BlinkenSend.o Tools2.o libBlinkenLib.$(SHLIBEXT) |
|
115 |
- $(CC) $(BIN_LDFLAGS) -o $@ $(filter %.o,$^) -lBlinkenLib $(BIN_LDLIBS) |
|
116 |
- |
|
117 |
-BlinkenRecv.o: BlinkenRecv.c BlinkenLib.h config.h BlinkenColorizer.h BlinkenProto.h BlinkenFrame.h BlinkenMovie.h Tools2.h |
|
118 |
- $(CC) $(CFLAGS) -c -o $@ $< |
|
119 |
- |
|
120 |
-BlinkenRecv: BlinkenRecv.o Tools2.o libBlinkenLib.$(SHLIBEXT) |
|
121 |
- $(CC) $(BIN_LDFLAGS) -o $@ $(filter %.o,$^) -lBlinkenLib $(BIN_LDLIBS) |
|
122 |
- |
|
123 |
-BlinkenOutput.o: BlinkenOutput.c BlinkenLib.h config.h BlinkenColorizer.h BlinkenProto.h BlinkenFrame.h BlinkenMovie.h |
|
124 |
- $(CC) $(CFLAGS) -c -o $@ $< |
|
125 |
- |
|
126 |
-BlinkenOutput: BlinkenOutput.o libBlinkenLib.$(SHLIBEXT) |
|
127 |
- $(CC) $(BIN_LDFLAGS) -o $@ $< -lBlinkenLib $(BIN_LDLIBS) |
|
128 |
- |
|
129 |
-BlinkenDeviceOutput.o: BlinkenDeviceOutput.c BlinkenLib.h config.h BlinkenColorizer.h BlinkenProto.h BlinkenFrame.h BlinkenMovie.h |
|
130 |
- $(CC) $(CFLAGS) -c -o $@ $< |
|
131 |
- |
|
132 |
-BlinkenDeviceOutput: BlinkenDeviceOutput.o libBlinkenLib.$(SHLIBEXT) |
|
133 |
- $(CC) $(BIN_LDFLAGS) -o $@ $< -lBlinkenLib $(BIN_LDLIBS) |
|
134 |
- |
|
135 |
-clean: |
|
136 |
- rm -f BlinkenConv BlinkenSend BlinkenRecv BlinkenOutput BlinkenDeviceOutput libBlinkenLib.$(SHLIBEXT)* libBlinkenLib.a *.o config.h |
|
137 |
- |
... | ... |
@@ -1,33 +1,268 @@ |
1 | 1 |
# BlinkenLib |
2 |
-# Copyright 2004-2016 Stefan Schuermans <stefan@schuermans.info> |
|
2 |
+# Copyright 2004-2019 Stefan Schuermans <stefan@schuermans.info> |
|
3 | 3 |
# Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html |
4 | 4 |
# a blinkenarea.org project |
5 | 5 |
|
6 | 6 |
include version.mk |
7 | 7 |
|
8 |
-UPDATE_FILES:=Makefile */Makefile */*.c */*.h |
|
9 |
-PACK_FILES:=BlinkenLib ChangeLog config examples install Makefile |
|
10 |
- |
|
11 |
-.PHONY: all conf clean distclean install uninstall update pack |
|
12 |
-.SUFFIXES: |
|
13 | 8 |
SUFFIXES := |
9 |
+.SUFFIXES: |
|
10 |
+ |
|
14 | 11 |
.SECONDARY: |
15 | 12 |
|
16 |
-all: conf |
|
17 |
- $(MAKE) -C BlinkenLib all |
|
13 |
+################## |
|
14 |
+# default target # |
|
15 |
+################## |
|
18 | 16 |
|
19 |
-conf: |
|
20 |
- $(MAKE) -C config all |
|
17 |
+.PHONY: all |
|
18 |
+all: build_all |
|
21 | 19 |
|
20 |
+########### |
|
21 |
+# cleanup # |
|
22 |
+########### |
|
23 |
+ |
|
24 |
+.PHONY: clean |
|
22 | 25 |
clean: |
23 |
- $(MAKE) -C BlinkenLib clean |
|
26 |
+ rm -rf build lib bin |
|
24 | 27 |
|
28 |
+.PHONY: distclean |
|
25 | 29 |
distclean: clean |
26 |
- $(MAKE) -C config clean |
|
30 |
+ rm -rf cfg |
|
31 |
+ |
|
32 |
+############ |
|
33 |
+# settings # |
|
34 |
+############ |
|
35 |
+ |
|
36 |
+CC := gcc |
|
37 |
+AR := ar |
|
38 |
+RANLIB := ranlib |
|
39 |
+INSTALL := install |
|
40 |
+ |
|
41 |
+################# |
|
42 |
+# configuration # |
|
43 |
+################# |
|
44 |
+ |
|
45 |
+CFG_INCDIR := -I/sw/include |
|
46 |
+CFG_LIBDIR := -L/sw/lib |
|
47 |
+ |
|
48 |
+CONFS := cfg/config.mk cfg/include/BlinkenLib/config.h |
|
49 |
+ |
|
50 |
+.PHONY: conf |
|
51 |
+conf: $(CONFS) ; |
|
52 |
+ |
|
53 |
+cfg: |
|
54 |
+ mkdir $@ |
|
55 |
+ |
|
56 |
+cfg/win.cfg: config/win.c | cfg |
|
57 |
+ if $(CC) -E -o /dev/null $<; \ |
|
58 |
+ then echo "WIN=1"; \ |
|
59 |
+ else echo "WIN=0"; \ |
|
60 |
+ fi >$@ |
|
61 |
+ |
|
62 |
+cfg/osx.cfg: | cfg |
|
63 |
+ if [ "$$(uname -s)" == "Darwin" ]; \ |
|
64 |
+ then echo "OSX=1"; \ |
|
65 |
+ else echo "OSX=0"; \ |
|
66 |
+ fi >$@ |
|
67 |
+ |
|
68 |
+cfg/bin: | cfg |
|
69 |
+ mkdir $@ |
|
70 |
+ |
|
71 |
+cfg/mng.cfg: | cfg/bin |
|
72 |
+ if $(CC) $(CFG_INCDIR) $(CFG_LIBDIR) -o cfg/bin/mng config/mng.c -lmng \ |
|
73 |
+ && cfg/bin/mng; \ |
|
74 |
+ then echo "MNG=1"; \ |
|
75 |
+ else echo "MNG=0"; \ |
|
76 |
+ fi >>$@ |
|
77 |
+ |
|
78 |
+cfg/gif%.cfg: | cfg/bin |
|
79 |
+ if $(CC) $(CFG_INCDIR) $(CFG_LIBDIR) -o cfg/bin/gif$* gif$*.c -lgif \ |
|
80 |
+ && ./cfg/bin/gif$*; \ |
|
81 |
+ then echo "GIF$*=1"; \ |
|
82 |
+ else echo "GIF$*=1"; \ |
|
83 |
+ fi >$@ |
|
84 |
+ |
|
85 |
+cfg/gif.cfg: cfg/gif4.cfg cfg/gif5.cfg |
|
86 |
+ if grep -q 1 $^; \ |
|
87 |
+ then echo "GIF=1"; \ |
|
88 |
+ else echo "GIF=0"; \ |
|
89 |
+ fi >$@ |
|
90 |
+ |
|
91 |
+cfg/config.cfg: $(addprefix cfg/,$(addsuffix .cfg,win osx mng gif gif4 gif5)) |
|
92 |
+ cat $^ >$@ |
|
93 |
+ |
|
94 |
+cfg/config.mk: cfg/config.cfg |
|
95 |
+ sed 's/^\([A-Z0-9]*\)=\([01]\)$$/BLINKENLIB_CFG_\1:=\2/' <$< >$@ |
|
96 |
+ |
|
97 |
+cfg/include: | cfg |
|
98 |
+ mkdir $@ |
|
99 |
+ |
|
100 |
+cfg/include/BlinkenLib: | cfg/include |
|
101 |
+ mkdir $@ |
|
102 |
+ |
|
103 |
+cfg/include/BlinkenLib/config.h: cfg/config.cfg version.mk \ |
|
104 |
+ | cfg/include/BlinkenLib |
|
105 |
+ sed 's/^\([A-Z0-9]*\)=0$$/#undef BLINKENLIB_CFG_\1/;s/^\([A-Z0-9]*\)=1$$/#define BLINKENLIB_CFG_\1/' <$< >$@ |
|
106 |
+ echo '#define BLINKENLIB_CONFIG "' | tr -d '\n' >>$@ |
|
107 |
+ sed 's/^\([A-Z0-9]*\)=0$$/\1-/;s/^\([A-Z0-9]*\)=1$$/\1+/' <$< | tr '\n' ' ' | sed 's/ *$$//' | tr -d '\n' >>$@ |
|
108 |
+ echo '"' >>$@ |
|
109 |
+ grep '^VERSION_[A-Z]* *:= *[0-9]*' version.mk | sed 's/^/#define BLINKENLIB_/;s/ *:= */ /' >>$@ |
|
110 |
+ |
|
111 |
+############### |
|
112 |
+# compilation # |
|
113 |
+############### |
|
114 |
+ |
|
115 |
+-include cfg/config.mk |
|
116 |
+ |
|
117 |
+CFLAGS := -Wall -Wextra -Werror -fPIC -O2 -Iinclude -Icfg/include |
|
118 |
+LIB_LDFLAGS := |
|
119 |
+LIB_LDLIBS := |
|
120 |
+TOOLS_LDFLAGS := -Llib |
|
121 |
+TOOLS_LDLIBS := |
|
122 |
+ |
|
123 |
+LIB_LIST := BlinkenColorizer BlinkenFrame BlinkenMovie BlinkenProto Tools |
|
124 |
+TOOLS_HELP_LIST := Tools2 |
|
125 |
+TOOLS_LIST := BlinkenConv BlinkenRecv BlinkenSend |
|
126 |
+ |
|
127 |
+ifeq ($(BLINKENLIB_CFG_MNG),1) |
|
128 |
+ LIB_LIST += BlinkenMng |
|
129 |
+ LIB_LDLIBS += -lmng -lz |
|
130 |
+endif |
|
131 |
+ |
|
132 |
+ifeq ($(BLINKENLIB_CFG_GIF),1) |
|
133 |
+ LIB_LIST += BlinkenGif |
|
134 |
+ LIB_LDLIBS += -lgif |
|
135 |
+endif |
|
136 |
+ |
|
137 |
+ifeq ($(BLINKENLIB_CFG_WIN),1) |
|
138 |
+ SHLIBEXT := dll |
|
139 |
+ TOOLS_SUFFIX := .exe |
|
140 |
+ LIB_LDLIBS += -lws2_32 |
|
141 |
+ TOOLS_LDLIBS += -lws2_32 |
|
142 |
+ TOOLS_LIST += BlinkenOutputWin |
|
143 |
+else |
|
144 |
+ ifeq ($(BLINKENLIB_CFG_OSX),1) |
|
145 |
+ CFLAGS += -I/sw/include |
|
146 |
+ SHLIBEXT := dylib |
|
147 |
+ TOOLS_SUFFIX := |
|
148 |
+ LIB_LDFLAGS += -L/sw/lib |
|
149 |
+ TOOLS_LDFLAGS += -L/sw/lib -Wl,-rpath,'$$ORIGIN/../lib' |
|
150 |
+ TOOLS_LIST += BlinkenDeviceOutput BlinkenOutput |
|
151 |
+ else |
|
152 |
+ SHLIBEXT := so |
|
153 |
+ TOOLS_SUFFIX := |
|
154 |
+ LIB_LDFLAGS += -Wl,-soname,libBlinkenLib.$(SHLIBEXT).$(VERSION_MAJOR) |
|
155 |
+ TOOLS_LDFLAGS += -Wl,-rpath,'$$ORIGIN/../lib' |
|
156 |
+ TOOLS_LIST += BlinkenDeviceOutput BlinkenOutput |
|
157 |
+ endif |
|
158 |
+endif |
|
159 |
+ |
|
160 |
+ALL_LIST := $(LIB_LIST) $(TOOLS_LIST) $(TOOLS_HELP_LIST) |
|
161 |
+ALL_DEPS := $(addprefix build/,$(addsuffix .d,$(ALL_LIST))) |
|
162 |
+ALL_OBJS := $(addprefix build/,$(addsuffix .o,$(ALL_LIST))) |
|
163 |
+LIB_OBJS := $(addprefix build/,$(addsuffix .o,$(LIB_LIST))) |
|
164 |
+TOOLS_HELP_OBJS := $(addprefix build/,$(addsuffix .o,$(TOOLS_HELP_LIST))) |
|
165 |
+TOOLS_BINS := $(addprefix bin/,$(addsuffix $(TOOLS_SUFFIX),$(TOOLS_LIST))) |
|
166 |
+ |
|
167 |
+-include $(ALL_DEPS) |
|
168 |
+ |
|
169 |
+.PHONY: build_all |
|
170 |
+build_all: conf $(ALL_DEPS) build_lib build_tools ; |
|
171 |
+ |
|
172 |
+.PHONY: build_lib |
|
173 |
+build_lib: lib/libBlinkenLib.a \ |
|
174 |
+ lib/libBlinkenLib.$(SHLIBEXT).$(VERSION_MAJOR) \ |
|
175 |
+ lib/libBlinkenLib.$(SHLIBEXT).$(VERSION) \ |
|
176 |
+ lib/libBlinkenLib.$(SHLIBEXT) ; |
|
177 |
+ |
|
178 |
+.PHONY: build_tools |
|
179 |
+build_tools: $(TOOLS_BINS) ; |
|
180 |
+ |
|
181 |
+build: |
|
182 |
+ mkdir $@ |
|
183 |
+ |
|
184 |
+build/%.d: src/%.c | build |
|
185 |
+ $(CC) $(CFLAGS) -MM -MT $(@:.d=.o) -o $@ $< |
|
186 |
+ |
|
187 |
+build/%.o: src/%.c | build |
|
188 |
+ $(CC) $(CFLAGS) -c -o $@ $< |
|
189 |
+ |
|
190 |
+lib: |
|
191 |
+ mkdir $@ |
|
192 |
+ |
|
193 |
+lib/libBlinkenLib.a: $(LIB_OBJS) | lib |
|
194 |
+ $(AR) cr $@ $^ |
|
195 |
+ $(RANLIB) $@ |
|
196 |
+ |
|
197 |
+lib/libBlinkenLib.$(SHLIBEXT).$(VERSION): $(LIB_OBJS) | lib |
|
198 |
+ $(CC) -shared $(LIB_LDFLAGS) -o $@ $+ $(LIB_LDLIBS) |
|
199 |
+ |
|
200 |
+lib/libBlinkenLib.$(SHLIBEXT).$(VERSION_MAJOR): lib/libBlinkenLib.$(SHLIBEXT).$(VERSION) |
|
201 |
+ ln -s $(notdir $<) $@ |
|
202 |
+ |
|
203 |
+lib/libBlinkenLib.$(SHLIBEXT): lib/libBlinkenLib.$(SHLIBEXT).$(VERSION_MAJOR) |
|
204 |
+ ln -s $(notdir $<) $@ |
|
205 |
+ |
|
206 |
+build/%.d: tools/%.c | build |
|
207 |
+ $(CC) $(CFLAGS) -MM -MT $(@:.d=.o) -o $@ $< |
|
208 |
+ |
|
209 |
+build/%.o: tools/%.c | build |
|
210 |
+ $(CC) $(CFLAGS) -c -o $@ $< |
|
211 |
+ |
|
212 |
+build/libBlinkenLibToolsHelp.a: $(TOOLS_HELP_OBJS) | lib |
|
213 |
+ $(AR) cr $@ $^ |
|
214 |
+ $(RANLIB) $@ |
|
215 |
+ |
|
216 |
+bin: |
|
217 |
+ mkdir $@ |
|
218 |
+ |
|
219 |
+$(TOOLS_BINS): bin/%: lib/libBlinkenLib.$(SHLIBEXT) |
|
220 |
+ |
|
221 |
+bin/%: build/%.o build/libBlinkenLibToolsHelp.a | bin |
|
222 |
+ $(CC) $(TOOLS_LDFLAGS) -o $@ $^ -lBlinkenLib $(TOOLS_LDLIBS) |
|
223 |
+ |
|
224 |
+################ |
|
225 |
+# installation # |
|
226 |
+################ |
|
227 |
+ |
|
228 |
+INSTALL_HEADER_LIST := BlinkenLib BlinkenMovie BlinkenFrame BlinkenColorizer \ |
|
229 |
+ BlinkenProto |
|
230 |
+ |
|
231 |
+ENV_PREFIX := $(shell echo $$PREFIX) |
|
232 |
+STOW_DIR := /usr/local/stow |
|
233 |
+STOW_PREFIX := $(STOW_DIR)/BlinkenLib-$(VERSION) |
|
234 |
+DEF_PREFIX := /usr/local |
|
235 |
+ifneq ($(ENV_PREFIX),) |
|
236 |
+ PREFIX := $(ENV_PREFIX) |
|
237 |
+else |
|
238 |
+ ifeq ($(shell if test -d $(STOW_DIR); then echo stow; fi),stow) |
|
239 |
+ PREFIX := $(STOW_PREFIX) |
|
240 |
+ else |
|
241 |
+ PREFIX := $(DEF_PREFIX) |
|
242 |
+ endif |
|
243 |
+endif |
|
244 |
+ |
|
245 |
+INSTALL_HEADERS := cfg/include/BlinkenLib/config.h \ |
|
246 |
+ $(addprefix include/BlinkenLib/,$(addsuffix .h,$(INSTALL_HEADER_LIST))) |
|
247 |
+INSTALL_LIBS := lib/libBlinkenLib.a lib/libBlinkenLib.$(SHLIBEXT).$(VERSION) |
|
248 |
+INSTALL_BINS := $(addprefix bin/,$(addsuffix $(TOOLS_SUFFIX),$(TOOLS_LIST))) |
|
27 | 249 |
|
28 |
-install: all |
|
29 |
- $(MAKE) -C install install |
|
250 |
+.PHONY: install |
|
251 |
+install: |
|
252 |
+ $(INSTALL) -d $(PREFIX)/include/BlinkenLib |
|
253 |
+ $(INSTALL) $(INSTALL_HEADERS) $(PREFIX)/include/BlinkenLib |
|
254 |
+ $(INSTALL) -d $(PREFIX)/lib |
|
255 |
+ $(INSTALL) $(INSTALL_LIBS) $(PREFIX)/lib |
|
256 |
+ ln -sf libBlinkenLib.$(SHLIBEXT).$(VERSION) $(PREFIX)/lib/libBlinkenLib.$(SHLIBEXT).$(VERSION_MAJOR) |
|
257 |
+ ln -sf libBlinkenLib.$(SHLIBEXT).$(VERSION_MAJOR) $(PREFIX)/lib/libBlinkenLib.$(SHLIBEXT) |
|
258 |
+ $(INSTALL) -d $(PREFIX)/bin |
|
259 |
+ $(INSTALL) $(INSTALL_BINS) $(PREFIX)/bin |
|
30 | 260 |
|
261 |
+.PHONY: uninstall |
|
31 | 262 |
uninstall: |
32 |
- $(MAKE) -C install uninstall |
|
263 |
+ rm -f $(addprefix $(PREFIX)/bin/,$(notdir $(INSTALL_BINS))) |
|
264 |
+ rm -f $(PREFIX)/lib/libBlinkenLib.$(SHLIBEXT) |
|
265 |
+ rm -f $(PREFIX)/lib/libBlinkenLib.$(SHLIBEXT).$(VERSION_MAJOR) |
|
266 |
+ rm -f $(addprefix $(PREFIX)/lib/,$(notdir $(INSTALL_LIBS))) |
|
267 |
+ rm -rf $(PREFIX)/include/BlinkenLib |
|
33 | 268 |
|
... | ... |
@@ -17,6 +17,9 @@ default instllation prefix is "/usr/local" |
17 | 17 |
if "/usr/local/stow" exists, default is "/usr/local/stow/BlinkenLib-#.#.#" |
18 | 18 |
set PREFIX environment variable for next steps to change installation prefix |
19 | 19 |
run "make install" as root |
20 |
+update the configuration of the system, for example: |
|
21 |
+ run "cd /usr/local/stow; stow BlinkenLib-#.#.#" as root |
|
22 |
+ run "ldconfig" as root |
|
20 | 23 |
|
21 | 24 |
cleaning source tree completely |
22 | 25 |
------------------------------- |
... | ... |
@@ -1,55 +0,0 @@ |
1 |
-# BlinkenLib |
|
2 |
-# Copyright 2004-2016 Stefan Schuermans <stefan@schuermans.info> |
|
3 |
-# Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html |
|
4 |
-# a blinkenarea.org project |
|
5 |
- |
|
6 |
-CC:=gcc |
|
7 |
-INCDIR:=-I/sw/include |
|
8 |
-LIBDIR:=-L/sw/lib |
|
9 |
- |
|
10 |
-CFGS:=$(addsuffix .cfg,win osx mng gif gif4 gif5) |
|
11 |
- |
|
12 |
-.PHONY: all clean |
|
13 |
-.SUFFIXES: |
|
14 |
-SUFFIXES:= |
|
15 |
-.SECONDARY: |
|
16 |
- |
|
17 |
-all: config.cfg config.mk config.h |
|
18 |
- |
|
19 |
-win.cfg: |
|
20 |
- if echo '#include <windows.h>' | $(CC) -E -x c - >/dev/null 2>/dev/null; then echo "WIN=1"; else echo "WIN=0"; fi >$@ |
|
21 |
- |
|
22 |
-osx.cfg: |
|
23 |
- echo "OSX=" | tr -d '\n' >$@ |
|
24 |
- (if [ "$$(uname -s)" == "Darwin" ]; then echo "1"; else echo "0"; fi) >>$@ |
|
25 |
- |
|
26 |
-mng.cfg: |
|
27 |
- echo "MNG=" | tr -d '\n' >$@ |
|
28 |
- (($(CC) $(INCDIR) $(LIBDIR) -o mng mng.c -lmng && ./mng && echo "1") || echo "0") >>$@ |
|
29 |
- rm -f mng |
|
30 |
- |
|
31 |
-gif%.cfg: |
|
32 |
- echo "GIF$*=" | tr -d '\n' >$@ |
|
33 |
- (($(CC) $(INCDIR) $(LIBDIR) -o gif$* gif$*.c -lgif && ./gif$* && echo "1") || echo "0") >>$@ |
|
34 |
- rm -f gif$* |
|
35 |
- |
|
36 |
-gif.cfg: gif4.cfg gif5.cfg |
|
37 |
- echo "GIF=" | tr -d '\n' >$@ |
|
38 |
- ((cat $^ | grep -q 1 && echo "1") || echo "0") >>$@ |
|
39 |
- |
|
40 |
-config.cfg: $(CFGS) |
|
41 |
- cat $^ >config.cfg |
|
42 |
- |
|
43 |
-config.mk: config.cfg |
|
44 |
- sed 's/^\([A-Z0-9]*\)=\([01]\)$$/BLINKENLIB_CFG_\1:=\2/' <$< >$@ |
|
45 |
- |
|
46 |
-config.h: config.cfg Makefile ../version.mk |
|
47 |
- sed 's/^\([A-Z0-9]*\)=0$$/#undef BLINKENLIB_CFG_\1/;s/^\([A-Z0-9]*\)=1$$/#define BLINKENLIB_CFG_\1/' <$< >$@ |
|
48 |
- echo '#define BLINKENLIB_CONFIG "' | tr -d '\n' >>$@ |
|
49 |
- sed 's/^\([A-Z0-9]*\)=0$$/\1-/;s/^\([A-Z0-9]*\)=1$$/\1+/' <$< | tr '\n' ' ' | sed 's/ *$$//' | tr -d '\n' >>$@ |
|
50 |
- echo '"' >>$@ |
|
51 |
- grep '^VERSION_[A-Z]*:=[0-9]*' ../version.mk | sed 's/^/#define BLINKENLIB_/;s/:=/ /' >>$@ |
|
52 |
- |
|
53 |
-clean: |
|
54 |
- rm -f $(CFGS) config.cfg config.mk config.h |
|
55 |
- |
... | ... |
@@ -0,0 +1 @@ |
1 |
+#include <windows.h> |
... | ... |
@@ -1,58 +0,0 @@ |
1 |
-# BlinkenLib |
|
2 |
-# Copyright 2004-2014 Stefan Schuermans <stefan@schuermans.info> |
|
3 |
-# Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html |
|
4 |
-# a blinkenarea.org project |
|
5 |
- |
|
6 |
-INSTALL:=install |
|
7 |
- |
|
8 |
-include ../version.mk |
|
9 |
-include ../config/config.mk |
|
10 |
- |
|
11 |
-ifeq ($(BLINKENLIB_CFG_OSX),1) |
|
12 |
-SHLIBEXT:=dylib |
|
13 |
-else |
|
14 |
-SHLIBEXT:=so |
|
15 |
-endif |
|
16 |
- |
|
17 |
-ENV_PREFIX:=$(shell echo $$PREFIX) |
|
18 |
-STOW_DIR:=/usr/local/stow |
|
19 |
-STOW_PREFIX:=$(STOW_DIR)/BlinkenLib-$(VERSION) |
|
20 |
-DEF_PREFIX:=/usr/local |
|
21 |
-ifneq ($(ENV_PREFIX),) |
|
22 |
- PREFIX:=$(ENV_PREFIX) |
|
23 |
-else |
|
24 |
- ifeq ($(shell if [ -d $(STOW_DIR) ]; then echo stow; fi),stow) |
|
25 |
- PREFIX:=$(STOW_PREFIX) |
|
26 |
- else |
|
27 |
- PREFIX:=$(DEF_PREFIX) |
|
28 |
- endif |
|
29 |
-endif |
|
30 |
- |
|
31 |
-HEADERS:=BlinkenLib.h BlinkenMovie.h BlinkenFrame.h BlinkenColorizer.h \ |
|
32 |
- BlinkenProto.h config.h |
|
33 |
-LIBS:=libBlinkenLib.a libBlinkenLib.$(SHLIBEXT).$(VERSION) |
|
34 |
-EXECS:=BlinkenConv BlinkenSend BlinkenRecv BlinkenOutput BlinkenDeviceOutput |
|
35 |
- |
|
36 |
-.PHONY: install uninstall |
|
37 |
-.SUFFIXES: |
|
38 |
-SUFFIXES:= |
|
39 |
-.SECONDARY: |
|
40 |
- |
|
41 |
-install: |
|
42 |
- $(INSTALL) -d $(PREFIX)/include/BlinkenLib |
|
43 |
- $(INSTALL) $(addprefix ../BlinkenLib/, $(HEADERS)) $(PREFIX)/include/BlinkenLib |
|
44 |
- $(INSTALL) -d $(PREFIX)/lib |
|
45 |
- $(INSTALL) $(addprefix ../BlinkenLib/, $(LIBS)) $(PREFIX)/lib |
|
46 |
- ln -sf libBlinkenLib.$(SHLIBEXT).$(VERSION) $(PREFIX)/lib/libBlinkenLib.$(SHLIBEXT).$(VERSION_MAJOR) |
|
47 |
- ln -sf libBlinkenLib.$(SHLIBEXT).$(VERSION_MAJOR) $(PREFIX)/lib/libBlinkenLib.$(SHLIBEXT) |
|
48 |
- $(INSTALL) -d $(PREFIX)/bin |
|
49 |
- $(INSTALL) $(addprefix ../BlinkenLib/, $(EXECS)) $(PREFIX)/bin |
|
50 |
- if which ldconfig; then ldconfig; fi |
|
51 |
- |
|
52 |
-uninstall: |
|
53 |
- rm -f $(addprefix $(PREFIX)/bin/, $(EXECS)) |
|
54 |
- rm -f $(PREFIX)/lib/libBlinkenLib.$(SHLIBEXT) |
|
55 |
- rm -f $(PREFIX)/lib/libBlinkenLib.$(SHLIBEXT).$(VERSION_MAJOR) |
|
56 |
- rm -f $(addprefix $(PREFIX)/lib/, $(LIBS)) |
|
57 |
- rm -rf $(PREFIX)/include/BlinkenLib |
|
58 |
- |
... | ... |
@@ -16,12 +16,12 @@ typedef DWORD uint32_t; |
16 | 16 |
#include <netinet/in.h> |
17 | 17 |
#endif |
18 | 18 |
|
19 |
-#include <BlinkenLib/BlinkenConstants.h> |
|
20 | 19 |
#include <BlinkenLib/BlinkenColorizer.h> |
21 | 20 |
#include <BlinkenLib/BlinkenFrame.h> |
22 |
-#include <BlinkenLib/Tools.h> |
|
23 | 21 |
|
24 |
-#include <BlinkenLib/BlinkenProtoIntern.h> |
|
22 |
+#include "BlinkenConstants.h" |
|
23 |
+#include "BlinkenProtoIntern.h" |
|
24 |
+#include "Tools.h" |
|
25 | 25 |
|
26 | 26 |
struct sBlinkenFrame { |
27 | 27 |
int height; |
... | ... |
@@ -7,10 +7,11 @@ |
7 | 7 |
#include <stdlib.h> |
8 | 8 |
|
9 | 9 |
#include <BlinkenLib/config.h> |
10 |
-#include <BlinkenLib/BlinkenConstants.h> |
|
11 | 10 |
#include <BlinkenLib/BlinkenFrame.h> |
12 | 11 |
#include <BlinkenLib/BlinkenMovie.h> |
13 |
-#include <BlinkenLib/BlinkenGif.h> |
|
12 |
+ |
|
13 |
+#include "BlinkenConstants.h" |
|
14 |
+#include "BlinkenGif.h" |
|
14 | 15 |
|
15 | 16 |
#ifdef BLINKENLIB_CFG_GIF5 |
16 | 17 |
# define GIF5_err , &giferr |
... | ... |
@@ -17,10 +17,11 @@ |
17 | 17 |
#include <libmng.h> |
18 | 18 |
|
19 | 19 |
#include <BlinkenLib/config.h> |
20 |
-#include <BlinkenLib/BlinkenConstants.h> |
|
21 | 20 |
#include <BlinkenLib/BlinkenFrame.h> |
22 | 21 |
#include <BlinkenLib/BlinkenMovie.h> |
23 |
-#include <BlinkenLib/BlinkenMng.h> |
|
22 |
+ |
|
23 |
+#include "BlinkenConstants.h" |
|
24 |
+#include "BlinkenMng.h" |
|
24 | 25 |
|
25 | 26 |
// type for state of the MNG read/write process |
26 | 27 |
typedef struct _BlMng_userdata { |
... | ... |
@@ -17,15 +17,16 @@ |
17 | 17 |
#include <sys/select.h> |
18 | 18 |
#endif |
19 | 19 |
|
20 |
-#include <BlinkenLib/BlinkenConstants.h> |
|
21 | 20 |
#include <BlinkenLib/BlinkenFrame.h> |
22 | 21 |
#include <BlinkenLib/BlinkenMovie.h> |
23 |
-#include <BlinkenLib/Tools.h> |
|
22 |
+ |
|
23 |
+#include "Tools.h" |
|
24 |
+#include "BlinkenConstants.h" |
|
24 | 25 |
#ifdef BLINKENLIB_CFG_MNG |
25 |
-#include <BlinkenLib/BlinkenMng.h> |
|
26 |
+#include "BlinkenMng.h" |
|
26 | 27 |
#endif // #ifdef BLINKENLIB_CFG_MNG |
27 | 28 |
#ifdef BLINKENLIB_CFG_GIF |
28 |
-#include <BlinkenLib/BlinkenGif.h> |
|
29 |
+#include "BlinkenGif.h" |
|
29 | 30 |
#endif // #ifdef BLINKENLIB_CFG_GIF |
30 | 31 |
|
31 | 32 |
struct sBlinkenMovie { |
... | ... |
@@ -16,7 +16,7 @@ typedef DWORD uint32_t; |
16 | 16 |
|
17 | 17 |
#include <BlinkenLib/BlinkenProto.h> |
18 | 18 |
|
19 |
-#include <BlinkenLib/BlinkenProtoIntern.h> |
|
19 |
+#include "BlinkenProtoIntern.h" |
|
20 | 20 |
|
21 | 21 |
int BlinkenProtoMakePacket(etBlinkenProto proto, etBlinkenPacket packet, |
22 | 22 |
char *pData, int maxLength) |