[linux-dvb] [patch 2/3] fix install target and CFLAGS

Ludwig Nussel ludwig.nussel at suse.de
Thu Sep 29 11:52:42 CEST 2005



Index: dvb-apps/lib/libdvbcfg/Makefile
===================================================================
--- dvb-apps.orig/lib/libdvbcfg/Makefile
+++ dvb-apps/lib/libdvbcfg/Makefile
@@ -26,12 +26,16 @@ INCLUDES = 	dvbcfg_common.h \
 
 DVBCFG_DEFAULT_DIR = /tmp
 
-CFLAGS ?= -O2 -g -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -DDVBCFG_DEFAULT_DIR=$(DVBCFG_DEFAULT_DIR)
+CFLAGS = -O2 -g -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith
+CFLAGS += -DDVBCFG_DEFAULT_DIR=$(DVBCFG_DEFAULT_DIR)
 CPPFLAGS = -I. -I../../include
 
 LIB = libdvbcfg.a
 RANLIB = ranlib
-INSTDIR=/tmp
+
+prefix = /usr/local
+libdir = $(prefix)/lib
+includedir = $(prefix)/include
 
 libdvbcfg.a: $(OBJS)
 	$(AR) rc $(LIB) $(OBJS)
@@ -41,10 +45,10 @@ test: $(LIB)
 	make -C test
 
 install: $(LIB) $(INCLUDES)
-	mkdir -p $(INSTDIR)/lib
-	mkdir -p $(INSTDIR)/include
-	cp -f $(LIB) $(INSTDIR)/lib
-	cp -f $(INCLUDES) $(INSTDIR)/include
+	mkdir -p $(DESTDIR)$(libdir)
+	mkdir -p $(DESTDIR)$(includedir)
+	install -m 755 $(LIB) $(DESTDIR)$(libdir)
+	install -m 644 $(INCLUDES) $(DESTDIR)$(includedir)
 
 clean:
 	rm -f *~ *# *.o *.a
Index: dvb-apps/libs/libdvb2/Makefile
===================================================================
--- dvb-apps.orig/libs/libdvb2/Makefile
+++ dvb-apps/libs/libdvb2/Makefile
@@ -27,15 +27,20 @@ INC =	common.h \
 CC = gcc
 LD = gcc
 
-CFLAGS = -Wall -Wformat -Wpointer-arith -g -fPIC
+CFLAGS = -Wall -Wformat -Wpointer-arith -g
+override CFLAGS += -fPIC
 CPPFLAGS = -MD -I../../include -I. -I../libsi2 $(DEFS)
 LDFLAGS = -shared -lc -lpthread -lrt -ldl
 
+# XXX: bad, use soname!
 TARGET = libdvb2.so
-INSTDIR = /usr/local
 DVBLIBS = -Lci -L../libsi2 -lci2 -lsi2
 TESTLIBS = -L. -L../libsi2 -ldvb2 -lsi2
 
+prefix = /usr/local
+libdir = $(prefix)/lib
+includedir = $(prefix)/include
+
 .PHONY: all ci plugins
 
 all: symlink $(TARGET) ci plugins test
@@ -54,11 +59,11 @@ ci:
 	$(MAKE) -C ci
 
 install: $(LIB) $(INC)
-	$(MAKE) -C plugins install INSTDIR=$(INSTDIR)
-	mkdir -p $(INSTDIR)/lib
-	mkdir -p $(INSTDIR)/include/dvb
-	cp -f $(TARGET) $(INSTDIR)/lib
-	cp -f $(INC) $(INSTDIR)/include/dvb
+	$(MAKE) -C plugins install
+	mkdir -p $(DESTDIR)$(libdir)
+	mkdir -p $(DESTDIR)$(includedir)/dvb
+	install -m 755 $(TARGET) $(DESTDIR)$(libdir)
+	install -m 755 $(INC) $(DESTDIR)$(includedir)/dvb
 
 test: test.c
 	$(CC) $(CFLAGS) $(CPPFLAGS) $(TESTLIBS) test.c -o test
Index: dvb-apps/libs/libdvb2/ci/Makefile
===================================================================
--- dvb-apps.orig/libs/libdvb2/ci/Makefile
+++ dvb-apps/libs/libdvb2/ci/Makefile
@@ -14,13 +14,16 @@ INCLUDES = 	ca.h \
 		ci_transport.h
 
 CC = gcc
-CFLAGS = -Wall -Wpointer-arith -g -fPIC
+CFLAGS = -Wall -Wpointer-arith -g
+override CFLAGS += -fPIC
 CPPFLAGS = -MD -I../../../include -I. -I.. -I../../libsi2 $(DEFS)
 LDFLAGS = -r
 
 TARGET = libci2.a
-INSTDIR= /usr/local
-DVBLIBS=-lc -Wl,-rpath . -Wl,-rpath si2 -L. -Lsi2 -lsi2 -ldvb2
+
+prefix = /usr/local
+libdir = $(prefix)/lib
+includedir = $(prefix)/include
 
 .PHONY: all
 
@@ -30,10 +33,10 @@ $(TARGET): $(OBJS)
 	$(LD) $(LDFLAGS) $(OBJS) -o $(TARGET)
 
 install: $(LIB) $(INCLUDES)
-	mkdir -p $(INSTDIR)/lib
-	mkdir -p $(INSTDIR)/include
-	cp -f $(LIB) $(INSTDIR)/lib
-	cp -f $(INCLUDES) $(INSTDIR)/include
+	mkdir -p $(DESTDIR)$(libdir)
+	mkdir -p $(DESTDIR)$(includedir)
+	install -m 644 $(LIB) $(DESTDIR)$(libdir)
+	install -m 755 $(INCLUDES) $(DESTDIR)$(includedir)
 
 clean:
 	rm -f *.d *.o $(TARGET)
Index: dvb-apps/libs/libdvb2/plugins/Makefile
===================================================================
--- dvb-apps.orig/libs/libdvb2/plugins/Makefile
+++ dvb-apps/libs/libdvb2/plugins/Makefile
@@ -2,12 +2,16 @@
 CC = gcc
 LD = gcc
 
-CFLAGS = -Wall -g -fPIC
+CFLAGS = -Wall -g
+override CFLAGS += -fPIC
 CPPFLAGS = -MD -I../../../include -I. -I.. -I../../libsi2 $(DEFS)
 LDFLAGS = -lc -L../ -ldvb2 -L../ci -lci2 -shared
 PLUGINS = ci_linklayer.so ci_highlevel.so
 
-INSTDIR = /usr/local
+prefix = /usr/local
+libdir = $(prefix)/lib
+includedir = $(prefix)/include
+
 
 .PHONY: all
 
@@ -17,8 +21,8 @@ all: $(PLUGINS)
 	$(LD) $(LDFLAGS) $< -o $@
 
 install: $(PLUGINS)
-	mkdir -p $(INSTDIR)/lib/dvb
-	cp -f $(PLUGINS) $(INSTDIR)/lib/dvb
+	mkdir -p $(DESTDIR)$(libdir)/dvb
+	install -m 644 $(PLUGINS) $(DESTDIR)$(libdir)/dvb
 
 clean:
 	rm -f *.d *.o *.so
Index: dvb-apps/libs/libdvbcfg/Makefile
===================================================================
--- dvb-apps.orig/libs/libdvbcfg/Makefile
+++ dvb-apps/libs/libdvbcfg/Makefile
@@ -30,15 +30,19 @@ INCLUDES = 	dvbcfg_common.h \
 
 DVBCFG_DEFAULT_DIR = /etc/dvb
 
-CFLAGS ?= -fPIC -O2 -g -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -DDVBCFG_DEFAULT_DIR=\"$(DVBCFG_DEFAULT_DIR)\"
-CPPFLAGS = -I. -I../../include
+CFLAGS = -O2 -g -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith
+override CFLAGS += -fPIC
+CPPFLAGS = -DDVBCFG_DEFAULT_DIR=\"$(DVBCFG_DEFAULT_DIR)\" -I. -I../../include
 LDFLAGS = -shared -lc
 
 STATICLIB = libdvbcfg.a
+# XXX: bad, use soname!
 SHAREDLIB = libdvbcfg.so
 RANLIB = ranlib
-STRIP = strip
-INSTDIR=/usr/local
+
+prefix = /usr/local
+libdir = $(prefix)/lib
+includedir = $(prefix)/include
 
 all: symlink $(STATICLIB) $(SHAREDLIB)
 
@@ -57,12 +61,11 @@ test: $(LIB)
 	make -C test
 
 install: $(STATICLIB) $(SHAREDLIB) $(INCLUDES)
-	mkdir -p $(INSTDIR)/lib
-	mkdir -p $(INSTDIR)/include/dvb/cfg
-	cp -f $(STATICLIB) $(INSTDIR)/lib
-	cp -f $(SHAREDLIB) $(INSTDIR)/lib
-	$(STRIP) $(INSTDIR)/lib/$(SHAREDLIB)
-	cp -f $(INCLUDES) $(INSTDIR)/include/dvb/cfg
+	mkdir -p $(DESTDIR)$(libdir)
+	mkdir -p $(DESTDIR)$(includedir)/dvb/cfg
+	install -m 644 $(STATICLIB) $(DESTDIR)$(libdir)
+	install -m 755 $(SHAREDLIB) $(DESTDIR)$(libdir)
+	install -m 644 $(INCLUDES) $(DESTDIR)$(includedir)/dvb/cfg
 
 clean:
 	rm -f *~ *# *.o *.a *.so cfg
Index: dvb-apps/libs/libsi2/Makefile
===================================================================
--- dvb-apps.orig/libs/libsi2/Makefile
+++ dvb-apps/libs/libsi2/Makefile
@@ -11,14 +11,19 @@ INC = 	common.h \
 	transport_packet.h
 
 CC = gcc
-CFLAGS = -Wall -Wpointer-arith -g -fPIC
+CFLAGS = -Wall -Wpointer-arith -g
+override CFLAGS += -fPIC
 CPPFLAGS = -MD -I. $(DEFS)
 LDFLAGS = -shared
 RANLIB = ranlib
 
+prefix = /usr/local
+libdir = $(prefix)/lib
+includedir = $(prefix)/include
+
 STATICLIB = libsi2.a
+# XXX: bad, use soname!
 SHAREDLIB = libsi2.so
-INSTDIR= /usr/local
 
 .PHONY: symlink all mpeg dvb atsc
 
@@ -36,15 +41,14 @@ $(STATICLIB): $(OBJ) mpeg dvb # atsc
 	$(RANLIB) $(STATICLIB)
 
 install: $(SHAREDLIB) $(STATICLIB) $(INC)
-	make -C mpeg install INSTDIR=$(INSTDIR)
-	make -C dvb install INSTDIR=$(INSTDIR)
-	make -C atsc install INSTDIR=$(INSTDIR)
-	mkdir -p $(INSTDIR)/lib
-	mkdir -p $(INSTDIR)/include/dvb/si
-	cp -f $(STATICLIB) $(INSTDIR)/lib
-	cp -f $(SHAREDLIB) $(INSTDIR)/lib
-	strip $(INSTDIR)/lib/$(SHAREDLIB)
-	cp -f $(INC) $(INSTDIR)/include/dvb/si
+	$(MAKE) -C mpeg install
+	$(MAKE) -C dvb install
+	$(MAKE) -C atsc install
+	mkdir -p $(DESTDIR)$(libdir)
+	mkdir -p $(DESTDIR)$(includedir)/dvb/si
+	install -m 644 $(STATICLIB) $(DESTDIR)$(libdir)
+	install -m 755 $(SHAREDLIB) $(DESTDIR)$(libdir)
+	install -m 644 $(INC) $(DESTDIR)$(includedir)/dvb/si
 
 mpeg:
 	$(MAKE) -C mpeg
Index: dvb-apps/libs/libsi2/atsc/Makefile
===================================================================
--- dvb-apps.orig/libs/libsi2/atsc/Makefile
+++ dvb-apps/libs/libsi2/atsc/Makefile
@@ -1,9 +1,14 @@
 
 CC = gcc
 CFLAGS = -Wall -Wpointer-arith -g
+override CFLAGS += -fPIC
 CPPFLAGS = -MD -I. -I.. $(DEFS)
 LDFLAGS = -r
 
+prefix = /usr/local
+libdir = $(prefix)/lib
+includedir = $(prefix)/include
+
 OBJ =
 INC = section.h \
       descriptor.h
@@ -18,8 +23,8 @@ $(TARGET): $(OBJ)
 	$(LD) $(LDFLAGS) $(OBJ) -o $(TARGET)
 
 install: $(LIB) $(INC)
-	mkdir -p $(INSTDIR)/include/dvb/si/atsc
-	cp -f $(INC) $(INSTDIR)/include/dvb/si/atsc
+	mkdir -p $(DESTDIR)$(includedir)/dvb/si/atsc
+	install -m 644 $(INC) $(DESTDIR)$(includedir)/dvb/si/atsc
 
 clean:
 	rm -f *.d *.o $(TARGET) test
Index: dvb-apps/libs/libsi2/dvb/Makefile
===================================================================
--- dvb-apps.orig/libs/libsi2/dvb/Makefile
+++ dvb-apps/libs/libsi2/dvb/Makefile
@@ -1,9 +1,14 @@
 
 CC = gcc
-CFLAGS = -Wall -Wpointer-arith -g -fPIC
+CFLAGS = -Wall -Wpointer-arith -g
+override CFLAGS += -fPIC
 CPPFLAGS = -MD -I. -I.. $(DEFS)
 LDFLAGS = -r
 
+prefix = /usr/local
+libdir = $(prefix)/lib
+includedir = $(prefix)/include
+
 OBJ = bat_section.o \
       eit_section.o \
       dit_section.o \
@@ -20,7 +25,7 @@ INC = section.h \
       bat_section.h \
       dit_section.h \
       eit_section.h \
-      int_sectio.h \
+      int_section.h \
       nit_section.h \
       rst_section.h \
       sdt_section.h \
@@ -87,8 +92,8 @@ $(TARGET): $(OBJ)
 	$(LD) $(LDFLAGS) $(OBJ) -o $(TARGET)
 
 install: $(LIB) $(INC)
-	mkdir -p $(INSTDIR)/include/dvb/si/dvb
-	cp -f $(INC) $(INSTDIR)/include/dvb/si/dvb
+	mkdir -p $(DESTDIR)$(includedir)/dvb/si/dvb
+	install -m 644 $(INC) $(DESTDIR)$(includedir)/dvb/si/dvb
 
 clean:
 	rm -f *.d *.o $(TARGET) test
Index: dvb-apps/libs/libsi2/mpeg/Makefile
===================================================================
--- dvb-apps.orig/libs/libsi2/mpeg/Makefile
+++ dvb-apps/libs/libsi2/mpeg/Makefile
@@ -1,9 +1,14 @@
 
 CC = gcc
-CFLAGS = -Wall -Wpointer-arith -g -fPIC
+CFLAGS = -Wall -Wpointer-arith -g
+override CFLAGS += -fPIC
 CPPFLAGS = -MD -I. -I.. $(DEFS)
 LDFLAGS = -r
 
+prefix = /usr/local
+libdir = $(prefix)/lib
+includedir = $(prefix)/include
+
 OBJ = cat_section.o \
       pat_section.o \
       pmt_section.o \
@@ -54,8 +59,8 @@ $(TARGET): $(OBJ)
 	$(LD) $(LDFLAGS) $(OBJ) -o $(TARGET)
 
 install: $(LIB) $(INC)
-	mkdir -p $(INSTDIR)/include/dvb/si/mpeg
-	cp -f $(INC) $(INSTDIR)/include/dvb/si/mpeg
+	mkdir -p $(DESTDIR)$(includedir)/dvb/si/mpeg
+	install -m 644 $(INC) $(DESTDIR)$(includedir)/dvb/si/mpeg
 
 clean:
 	rm -f *.d *.o $(TARGET) test

--
 (o_   Ludwig Nussel
 //\   SUSE LINUX Products GmbH, Development
 V_/_  http://www.suse.de/



More information about the linux-dvb mailing list