Stefan Schuermans commited on 2011-09-11 17:17:19
Showing 29 changed files, with 69 additions and 46 deletions.
| ... | ... |
@@ -1,5 +1,5 @@ |
| 1 | 1 |
# FlexiPix library |
| 2 |
-# !version: 1.0.4! !date: 2010-09-19! |
|
| 2 |
+# !version: 1.0.5! !date: 2010-12-22! |
|
| 3 | 3 |
# |
| 4 | 4 |
# Copyright 2010 Stefan Schuermans <stefan schuermans info> |
| 5 | 5 |
# |
| ... | ... |
@@ -19,15 +19,37 @@ |
| 19 | 19 |
LIBTARGET=libflexipix |
| 20 | 20 |
VER=1 |
| 21 | 21 |
VERMIN=0 |
| 22 |
-VERREV=4 |
|
| 23 |
- |
|
| 24 |
-SRCS=$(wildcard src/*.c) |
|
| 25 |
-EX_SRCS=$(wildcard examples/src/*.c) |
|
| 22 |
+VERREV=5 |
|
| 26 | 23 |
|
| 24 |
+OS:=$(shell uname -s) |
|
| 25 |
+ifeq ($(OS),Linux) |
|
| 26 |
+ SED_I=sed -i |
|
| 27 |
+ CC=gcc |
|
| 28 |
+ AR=ar |
|
| 29 |
+ SHLIBFLAGS=-shared -Wl,-soname,$(LIBTARGET).so.$(VER) |
|
| 30 |
+ SHLIBEXT=so |
|
| 31 |
+ RANLIB=ranlib |
|
| 32 |
+ INSTALL=install |
|
| 33 |
+ STOW_DIR=/usr/local/stow |
|
| 34 |
+ DEF_PREFIX=/usr/local |
|
| 35 |
+else |
|
| 36 |
+ ifeq ($(OS),Darwin) |
|
| 37 |
+ SED_I=sed -i "" |
|
| 27 | 38 |
CC=gcc |
| 28 | 39 |
AR=ar |
| 40 |
+ SHLIBFLAGS=-dynamiclib |
|
| 41 |
+ SHLIBEXT=dylib |
|
| 29 | 42 |
RANLIB=ranlib |
| 30 | 43 |
INSTALL=install |
| 44 |
+ STOW_DIR=/usr/local/stow |
|
| 45 |
+ DEF_PREFIX=/usr/local |
|
| 46 |
+ else |
|
| 47 |
+ $(error unsupported OS) |
|
| 48 |
+ endif |
|
| 49 |
+endif |
|
| 50 |
+ |
|
| 51 |
+SRCS=$(wildcard src/*.c) |
|
| 52 |
+EX_SRCS=$(wildcard examples/src/*.c) |
|
| 31 | 53 |
|
| 32 | 54 |
CFLAGS=-W -Wall -fPIC -O3 |
| 33 | 55 |
DEFINES=-DFLP_VER_MAJ=$(VER) -DFLP_VER_MIN=$(VERMIN) -DFLP_VER_REV=$(VERREV) |
| ... | ... |
@@ -44,7 +66,7 @@ EX_OBJS=$(addsuffix .o,$(EX_SRCS_BASE)) |
| 44 | 66 |
EX_TARGETS=$(EX_SRCS_BASE) |
| 45 | 67 |
|
| 46 | 68 |
LIBTGA = lib/$(LIBTARGET).a |
| 47 |
-LIBTGSO = lib/$(LIBTARGET).so.$(VER) |
|
| 69 |
+LIBTGSO = lib/$(LIBTARGET).$(SHLIBEXT).$(VER) |
|
| 48 | 70 |
LIBTGSOM = $(LIBTGSO).$(VERMIN) |
| 49 | 71 |
LIBTGSOR = $(LIBTGSOM).$(VERREV) |
| 50 | 72 |
|
| ... | ... |
@@ -55,9 +77,7 @@ PACKDATA = ChangeLog COPYING COPYING.LESSER Makefile \ |
| 55 | 77 |
examples include README src |
| 56 | 78 |
|
| 57 | 79 |
ENV_PREFIX=$(shell echo $$PREFIX) |
| 58 |
-STOW_DIR=/usr/local/stow |
|
| 59 | 80 |
STOW_PREFIX=$(STOW_DIR)/libflexipix-$(VERSION) |
| 60 |
-DEF_PREFIX=/usr/local |
|
| 61 | 81 |
ifneq ($(ENV_PREFIX),) |
| 62 | 82 |
PREFIX=$(ENV_PREFIX) |
| 63 | 83 |
else |
| ... | ... |
@@ -83,7 +103,7 @@ deps: $(DEPS) $(EX_DEPS) |
| 83 | 103 |
|
| 84 | 104 |
%.d: %.c |
| 85 | 105 |
$(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -M -o $@ $< |
| 86 |
- sed -i 's!^$(basename $(notdir $<))!$(dir $<)&!' $@ |
|
| 106 |
+ $(SED_I) 's!^$(basename $(notdir $<))!$(dir $<)&!' $@ |
|
| 87 | 107 |
|
| 88 | 108 |
%.o: %.c |
| 89 | 109 |
$(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -c -o $@ $< |
| ... | ... |
@@ -99,8 +119,7 @@ $(LIBTGA): $(OBJS) lib |
| 99 | 119 |
$(RANLIB) $@ |
| 100 | 120 |
|
| 101 | 121 |
$(LIBTGSOR): $(OBJS) |
| 102 |
- $(CC) -shared -Wl,-soname,$(LIBTARGET).so.$(VER) $(LDFLAGS) \ |
|
| 103 |
- -o $@ $+ |
|
| 122 |
+ $(CC) $(SHLIBFLAGS) $(LDFLAGS) -o $@ $+ |
|
| 104 | 123 |
|
| 105 | 124 |
$(LIBTGSOM): $(LIBTGSOR) |
| 106 | 125 |
rm -f $@ |
| ... | ... |
@@ -112,18 +131,18 @@ $(LIBTGSO): $(LIBTGSOM) |
| 112 | 131 |
|
| 113 | 132 |
clean: |
| 114 | 133 |
rm -rf deps $(DEPS) $(OBJS) lib \ |
| 115 |
- $(EX_DEPS) $(EX_OBJS) $(EX_TARGETS) \ |
|
| 116 |
- pack |
|
| 134 |
+ $(EX_DEPS) $(EX_OBJS) $(EX_TARGETS) |
|
| 117 | 135 |
|
| 118 | 136 |
pack: |
| 119 | 137 |
$(MAKE) clean |
| 138 |
+ $(SED_I) 's/!version: [0-9.]*!/!version: $(VERSION)!/g' $$(find $(PACKDATA) -type f) |
|
| 139 |
+ $(SED_I) 's/!date: [0-9-]*!/!date: $(DATE)!/g' $$(find $(PACKDATA) -type f) |
|
| 120 | 140 |
$(MAKE) |
| 121 | 141 |
$(MAKE) clean |
| 122 | 142 |
mkdir -p pack/$(PACKNAME) |
| 123 | 143 |
cp -r $(PACKDATA) pack/$(PACKNAME) |
| 124 |
- sed -i 's/!version: 1.0.4!]*!/!version: 1.0.4!/g' $$(find pack -type f) |
|
| 125 |
- sed -i 's/!date: 2010-09-19!]*!/!date: 2010-09-19!/g' $$(find pack -type f) |
|
| 126 |
- cd pack; tar jcf ../$(PACKNAME).tar.bz2 $(PACKNAME) |
|
| 144 |
+ cd pack; tar jcf $(PACKNAME).tar.bz2 $(PACKNAME) |
|
| 145 |
+ rm -rf pack/$(PACKNAME) |
|
| 127 | 146 |
$(MAKE) clean |
| 128 | 147 |
|
| 129 | 148 |
install: all |
| ... | ... |
@@ -4,7 +4,7 @@ |
| 4 | 4 |
|
| 5 | 5 |
#include <flexipix/flexipix.h> |
| 6 | 6 |
|
| 7 |
-/* just an exmaple for some data */ |
|
| 7 |
+/* just an example for some data */ |
|
| 8 | 8 |
typedef struct userdata_s {
|
| 9 | 9 |
int i; |
| 10 | 10 |
float f; |
| ... | ... |
@@ -46,7 +46,7 @@ void msg(void *p_ctx, flp_msg_type_t type, const char *fmt, ...) |
| 46 | 46 |
int main(int argc, char *argv[]) |
| 47 | 47 |
{
|
| 48 | 48 |
const char *config; |
| 49 |
- userdata_t userdata = { 42, 42.0, '!' }; /* just an exmaple */
|
|
| 49 |
+ userdata_t userdata = { 42, 42.0, '!' }; /* just an example */
|
|
| 50 | 50 |
flp_display_t *p_display; |
| 51 | 51 |
unsigned int width, height, i; |
| 52 | 52 |
flp_u8_t white[3] = { 255, 255, 255 };
|
| ... | ... |
@@ -4,7 +4,7 @@ |
| 4 | 4 |
|
| 5 | 5 |
#include <flexipix/flexipix.h> |
| 6 | 6 |
|
| 7 |
-/* just an exmaple for some data */ |
|
| 7 |
+/* just an example for some data */ |
|
| 8 | 8 |
typedef struct userdata_s {
|
| 9 | 9 |
int i; |
| 10 | 10 |
float f; |
| ... | ... |
@@ -46,7 +46,7 @@ void msg(void *p_ctx, flp_msg_type_t type, const char *fmt, ...) |
| 46 | 46 |
int main(int argc, char *argv[]) |
| 47 | 47 |
{
|
| 48 | 48 |
const char *config; |
| 49 |
- userdata_t userdata = { 42, 42.0, '!' }; /* just an exmaple */
|
|
| 49 |
+ userdata_t userdata = { 42, 42.0, '!' }; /* just an example */
|
|
| 50 | 50 |
flp_displayer_t *p_displayer; |
| 51 | 51 |
unsigned int width, height, i, j, c, x, y; |
| 52 | 52 |
flp_u8_t *p_image; |
| ... | ... |
@@ -4,7 +4,7 @@ |
| 4 | 4 |
|
| 5 | 5 |
#include <flexipix/flexipix.h> |
| 6 | 6 |
|
| 7 |
-/* just an exmaple for some data */ |
|
| 7 |
+/* just an example for some data */ |
|
| 8 | 8 |
typedef struct userdata_s {
|
| 9 | 9 |
int i; |
| 10 | 10 |
float f; |
| ... | ... |
@@ -46,7 +46,7 @@ void msg(void *p_ctx, flp_msg_type_t type, const char *fmt, ...) |
| 46 | 46 |
int main(int argc, char *argv[]) |
| 47 | 47 |
{
|
| 48 | 48 |
const char *config; |
| 49 |
- userdata_t userdata = { 42, 42.0, '!' }; /* just an exmaple */
|
|
| 49 |
+ userdata_t userdata = { 42, 42.0, '!' }; /* just an example */
|
|
| 50 | 50 |
flp_display_t *p_display; |
| 51 | 51 |
unsigned int width, height, i, x, y; |
| 52 | 52 |
flp_u8_t *p_image; |