1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
diff -ur libezV24-0.1.1.orig/Makefile libezV24-0.1.1/Makefile
--- libezV24-0.1.1.orig/Makefile 2003-02-17 15:46:18.000000000 +0200
+++ libezV24-0.1.1/Makefile 2008-01-15 10:47:13.000000000 +0200
@@ -19,68 +19,63 @@
# the base name of the library
SOBASE = ezV24
-# define the destination OS (currently only linux)
-PLATFORM=__LINUX__
-
-# the base path where the file should be installed to.
-PREFIX = /usr/local
+# the base paths where the files should be installed to.
+PREFIX = /usr
+LIBDIR = $(PREFIX)/lib
+
+# an additional prefix for building RPM packages. NOTE: don't forget to add a
+# trailing slash!
+DESTDIR =
# generate the name of the output file in dependence of the development state.
#
-ifeq "${RELEASE}" "DEBUG"
+ifeq ($(RELEASE),DEBUG)
NAME = lib$(SOBASE).so.$(SORELEASE).dbg
else
NAME = lib$(SOBASE).so.$(VERSION)
endif
SONAME = lib$(SOBASE).so.$(SORELEASE)
-LIBNAME = lib$(SOBASE)-$(SORELEASE)_s.a
+LIBNAME = lib$(SOBASE).a
PLAINNAME = lib$(SOBASE).so
# basename of the project
PROJECTNAME = libezV24-$(VERSION).$(PATCHLEVEL)
-OBJS = ezV24.o snprintf.o
+STATIC_OBJS = ezV24.o snprintf.o
+SHARED_OBJS = $(patsubst %.o,%.lo,$(STATIC_OBJS))
LIBS =
-
-ifeq "${RELEASE}" "DEBUG"
-C_FLAG = -c -Wall -fPIC -D$(PLATFORM) $(INCDIR)
-C_DEFS = -DDEBUG -DBETA
-LFLAGS = $(LIBDIR)
+ifeq ($(RELEASE),DEBUG)
+CPPFLAGS += -DDEBUG -DBETA
else
-ifeq "${RELEASE}" "BETA"
-C_FLAG = -c -Wall -fPIC -O2 -D$(PLATFORM) $(INCDIR)
-C_DEFS = -DBETA
-LFLAGS = $(LIBDIR)
+ifeq ($(RELEASE),BETA)
+CPPFLAGS += -DBETA
else
-C_FLAG = -c -Wall -fPIC -O2 -D$(PLATFORM) $(INCDIR)
-C_DEFS = -DFINAL
-LFLAGS = -s $(LIBDIR)
+CPPFLAGS += -DFINAL
endif
endif
+CC ?= gcc
+CPPFLAGS += -I.
+CFLAGS ?= -O2
+CFLAGS += -Wall
+
# tools to build the static library
ARFLAGS = cru
-AR = ar
-RANLIB = ranlib
-
-# concatinate the compile flags
-CFLAGS = $(C_FLAG) $(C_DEFS)
+AR ?= ar
+RANLIB ?= ranlib
-
-
-# ------------------------------------------------------------------------
-# AUTOMATISCHE COMPILE-ANWEISUNGEN
-# ------------------------------------------------------------------------
-
-.c.o:
- gcc $(CFLAGS) $<
+# some distros have a messed up path when in su -
+LDCONFIG ?= /sbin/ldconfig
# --------------------------------------------------------------------------
# ANH�NGIGKEITEN
# --------------------------------------------------------------------------
+%.lo: %.c
+ $(CC) -fPIC $(CFLAGS) $(CPPFLAGS) -c $< -o $@
+
all: shared static test-v24
shared: $(NAME)
@@ -88,13 +83,13 @@
static: $(LIBNAME)
+$(NAME): $(SHARED_OBJS)
+ $(CC) $(CFLAGS) -shared -Wl,-soname,$(SONAME) -o $@ $^ $(LDFLAGS)
-$(NAME): $(OBJS)
- gcc -shared -W1,soname,$(SONAME) -o $(NAME) $(OBJS)
+$(LIBNAME): $(STATIC_OBJS)
+ $(AR) $(ARFLAGS) $@ $^
+ $(RANLIB) $@
-$(LIBNAME): $(OBJS)
- $(AR) $(ARFLAGS) $(LIBNAME) $(OBJS)
- $(RANLIB) $(LIBNAME)
# Abh�ngigkeiten des Source, jedoch dann ohne Generierungsanweisung, wenn
@@ -111,22 +106,27 @@
#
install:
- install -d -m 755 $(PREFIX)/include/$(SOBASE)/;
- install -m 644 ezV24.h $(PREFIX)/include/$(SOBASE)/
- install -m 644 -s $(LIBNAME) $(PREFIX)/lib/$(LIBNAME)
- install -m 755 -s $(NAME) $(PREFIX)/lib/$(NAME)
- rm -f $(PREFIX)/lib/$(SONAME) $(PREFIX)/lib/$(PLAINNAME)
- ln -s $(PREFIX)/lib/$(NAME) $(PREFIX)/lib/$(SONAME);\
- ln -s $(PREFIX)/lib/$(SONAME) $(PREFIX)/lib/$(PLAINNAME);\
- ldconfig
+ install -d -m 755 $(DESTDIR)$(PREFIX)/include/$(SOBASE)
+ install -d -m 755 $(DESTDIR)$(LIBDIR)
+ install -m 644 ezV24.h $(DESTDIR)$(PREFIX)/include/$(SOBASE)/
+ install -m 644 $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
+ install -m 755 $(NAME) $(DESTDIR)$(LIBDIR)/$(NAME)
+ rm -f $(DESTDIR)$(PREFIX)/lib/$(SONAME) $(DESTDIR)$(LIBDIR)/$(PLAINNAME)
+ ln -s $(NAME) $(DESTDIR)$(LIBDIR)/$(SONAME)
+ ln -s $(SONAME) $(DESTDIR)$(LIBDIR)/$(PLAINNAME)
+ if [ -z $$NO_LDCONFIG ]; then \
+ $(LDCONFIG); \
+ fi
uninstall:
rm -f $(PREFIX)/include/ezV24/*
rmdir $(PREFIX)/include/ezV24
- rm -f $(PREFIX)/lib/$(LIBNAME)
- rm -f $(PREFIX)/lib/$(NAME)
- rm -f $(PREFIX)/lib/$(SONAME) $(PREFIX)/lib/$(PLAINNAME)
- ldconfig
+ rm -f $(LIBDIR)/$(LIBNAME)
+ rm -f $(LIBDIR)/$(NAME)
+ rm -f $(LIBDIR)/$(SONAME) $(LIBDIR/$(PLAINNAME)
+ if [ -z $$NO_LDCONFIG ]; then \
+ $(LDCONFIG); \
+ fi
# This entry is for packing a distribution tarball
@@ -157,7 +157,7 @@
# gcc -o test-v24 -Wall test-v24.c -l$(SOBASE)
#
test-v24: test-v24.c ezV24.h $(LIBNAME)
- gcc -o test-v24 -Wall test-v24.c -L./ $(LIBNAME)
+ $(CC) -o test-v24 -Wall -DUNINSTALLED test-v24.c -L./ $(LIBNAME)
# --------------------------------------------------------------------------
@@ -165,7 +165,7 @@
# --------------------------------------------------------------------------
clean:
- rm -f *.o core
+ rm -f *.o *.lo core
clean-all:
rm -f *.o core test-v24 $(NAME) $(LIBNAME)
|