aboutsummaryrefslogtreecommitdiffstats
path: root/unmaintained/ladspa/0001-proper-build.patch
blob: fa3a6c43ee35da21fdda3ad2a78b7afe1c077a44 (plain)
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
From b87125e3eeb3e3446f80566083e5d66e7a667567 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Sat, 4 Feb 2012 21:22:13 +0000
Subject: [PATCH 1/3] proper build

---
 src/makefile |   50 +++++++++++++++++++++++++++++---------------------
 1 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/src/makefile b/src/makefile
index 886237f..10ce82d 100644
--- a/src/makefile
+++ b/src/makefile
@@ -13,10 +13,12 @@ INSTALL_BINARY_DIR	=	/usr/bin/
 # GENERAL
 #
 
+CFLAGS		?=	-Wall -Werror -O3
+CXXFLAGS	?=	-Wall -Werror -O3
+
 INCLUDES	=	-I.
-LIBRARIES	=	-ldl -lm
-CFLAGS		=	$(INCLUDES) -Wall -Werror -O3 -fPIC
-CXXFLAGS	=	$(CFLAGS)
+DYNAMIC_LD_LIBS =	-ldl
+LIBRARIES	=	$(DYNAMIC_LD_LIBS) -lm
 PLUGINS		=	../plugins/amp.so				\
 			../plugins/delay.so				\
 			../plugins/filter.so				\
@@ -25,21 +27,27 @@ PLUGINS		=	../plugins/amp.so				\
 PROGRAMS	=	../bin/analyseplugin				\
 			../bin/applyplugin 				\
 			../bin/listplugins
-CC		=	cc
-CPP		=	c++
+CC		?=	cc
+CXX		?=	c++
+MKDIR_P		?=	mkdir -p
 
 ###############################################################################
 #
 # RULES TO BUILD PLUGINS FROM C OR C++ CODE
 #
 
+LDFLAGS_filter	= -lm
+
 ../plugins/%.so:	plugins/%.c ladspa.h
-	$(CC) $(CFLAGS) -o plugins/$*.o -c plugins/$*.c
-	$(LD) -o ../plugins/$*.so plugins/$*.o -shared
+	$(CC) $(CFLAGS) $(INCLUDES) -fPIC -o plugins/$*.o -c plugins/$*.c
+	$(CC) $(CFLAGS) $(LDFLAGS) -o ../plugins/$*.so plugins/$*.o -shared $(LDFLAGS_$*)
 
 ../plugins/%.so:	plugins/%.cpp ladspa.h
-	$(CPP) $(CXXFLAGS) -o plugins/$*.o -c plugins/$*.cpp
-	$(CPP) -o ../plugins/$*.so plugins/$*.o -shared
+	$(CXX) $(CXXFLAGS) $(INCLUDES) -fPIC -o plugins/$*.o -c plugins/$*.cpp
+	$(CXX) $(LDFLAGS) -o ../plugins/$*.so plugins/$*.o -shared $(LDFLAGS_$*)
+
+%.o: %.c
+	$(CC) $(CFLAGS) -DPLUGINDIR=\"$(INSTALL_PLUGINS_DIR)\" -c $<
 
 ###############################################################################
 #
@@ -59,12 +67,12 @@ test:	/tmp/test.wav ../snd/noise.wav always
 	@echo Test complete.
 
 install:	targets
-	-mkdirhier $(INSTALL_PLUGINS_DIR)
-	-mkdirhier $(INSTALL_INCLUDE_DIR)
-	-mkdirhier $(INSTALL_BINARY_DIR)
-	cp ../plugins/* $(INSTALL_PLUGINS_DIR)
-	cp ladspa.h $(INSTALL_INCLUDE_DIR)
-	cp ../bin/* $(INSTALL_BINARY_DIR)
+	-$(MKDIR_P) $(DESTDIR)$(INSTALL_PLUGINS_DIR)
+	-$(MKDIR_P) $(DESTDIR)$(INSTALL_INCLUDE_DIR)
+	-$(MKDIR_P) $(DESTDIR)$(INSTALL_BINARY_DIR)
+	cp ../plugins/* $(DESTDIR)$(INSTALL_PLUGINS_DIR)
+	cp ladspa.h $(DESTDIR)$(INSTALL_INCLUDE_DIR)
+	cp ../bin/* $(DESTDIR)$(INSTALL_BINARY_DIR)
 
 /tmp/test.wav:	targets ../snd/noise.wav
 	../bin/listplugins
@@ -90,19 +98,19 @@ targets:	$(PLUGINS) $(PROGRAMS)
 #
 
 ../bin/applyplugin:	applyplugin.o load.o default.o
-	$(CC) $(CFLAGS) $(LIBRARIES)					\
+	$(CC) $(CFLAGS) $(INCLUDES) $(LDFLAGS)				\
 		-o ../bin/applyplugin					\
-		applyplugin.o load.o default.o
+		applyplugin.o load.o default.o $(LIBRARIES)
 
 ../bin/analyseplugin:	analyseplugin.o load.o default.o
-	$(CC) $(CFLAGS) $(LIBRARIES)					\
+	$(CC) $(CFLAGS) $(INCLUDES) $(LDFLAGS)				\
 		-o ../bin/analyseplugin 				\
-		analyseplugin.o load.o default.o
+		analyseplugin.o load.o default.o $(LIBRARIES)
 
 ../bin/listplugins:	listplugins.o search.o
-	$(CC) $(CFLAGS) $(LIBRARIES)					\
+	$(CC) $(CFLAGS) $(INCLUDES) $(LDFLAGS)				\
 		-o ../bin/listplugins	 				\
-		listplugins.o search.o
+		listplugins.o search.o $(LIBRARIES)
 
 ###############################################################################
 #
-- 
1.7.9