summaryrefslogtreecommitdiff
blob: 3b806d809f4eb582404e0caf01cde499f59079e1 (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
--- Makefile
+++ Makefile
@@ -2,10 +2,8 @@
 # spcaview Makefile
 ##############################
 
-INSTALLROOT=$(PWD)
+DESTDIR=$(PWD)
 
-CC=gcc
-CPP=g++
 INSTALL=install
 APP_BINARY=spcaview
 BIN=/usr/local/bin
@@ -13,7 +11,6 @@
 SDLLIBS = $(shell sdl-config --libs) 
 SDLFLAGS = $(shell sdl-config --cflags)
 
-SERVFLAGS= -O2 -DLINUX $(WARNINGS)
 MATH_LIB=-lm 
 SERVLIBS= $(MATH_LIB) -lpthread
 
@@ -25,9 +22,8 @@
 #           -Wno-unused
 #           -Wunused
 
-CFLAGS = -DUSE_SDL -O2 -DLINUX $(SDLFLAGS) $(WARNINGS)
-CPPFLAGS = $(CFLAGS)
-SHCFLAGS=  -O2 -ffast-math -fforce-addr -fstrict-aliasing -fomit-frame-pointer
+CFLAGS ?= -O2
+CFLAGS += $(SDLFLAGS) $(WARNINGS)
 #CLIBFLAGS= -O9 -falign-functions=4 -march=athlon 
 #LIB_ENCODE = libjpgenc.a
 #LIB_ENCODE_OBJECTS = encoder.o huffman.o marker.o quant.o
@@ -36,7 +32,7 @@
 		dpsh.o shc.o shclib.o\
 		audioin_devdsp.o SDL_audioin.o
 		
-OBJSERVER= server.o spcav4l.o utils.o tcputils.o pargpio.o encoder.o huffman.o marker.o quant.o
+OBJSERVER= spcaserv.o spcav4l.o utils.o tcputils.o pargpio.o encoder.o huffman.o marker.o quant.o
 
 OBJCAT= spcacat.o spcav4l.o utils.o picture.o pargpio.o encoder.o huffman.o marker.o quant.o avilib.o		
 
@@ -52,74 +48,30 @@
 
 # Applications:
 spcaview:	$(OBJECTS)
-	$(CC)	$(CFLAGS) $(OBJECTS) $(X11_LIB) $(XPM_LIB)\
-		$(MATH_LIB) \
-		$(SDLLIBS)\
-		-o $(APP_BINARY)
-	chmod 755 $(APP_BINARY)
-
+spcaview:	LDLIBS += -lm $(SDLLIBS)
 spcaserv: $(OBJSERVER)
-	gcc $(SERVFLAGS) -o spcaserv $(OBJSERVER) $(SERVLIBS)
-	
+spcaserv: LDLIBS += -lm -lpthread
 spcacat: $(OBJCAT)
-	gcc $(SERVFLAGS) -o spcacat $(OBJCAT) $(SERVLIBS)
+spcacat: LDLIBS += -lm -lpthread
 	
-spcaview.o: spcaview.c  jconfig.h dpsh.h utils.h SDL_audioin.h
-
-
-shc.o : shc.c shc.h
-	$(CC) $(SHCFLAGS) -c -o $@ $<
-shclib.o: shclib.c shclib.h
-	$(CC) $(SHCFLAGS) -c -o $@ $<
-dpsh.o: dpsh.c  dpsh.h
-	$(CC) $(SHCFLAGS) -c -o $@ $<
+-include .depend
+.depend: $(wildcard *.c *.h)
+	$(CC) $(CPPFLAGS) -MM $^ > .depend
 
-avilib.o: avilib.c avilib.h
-		$(CC) $(SERVFLAGS) -c -o $@ $<
-	
-server.o:	server.c
-		$(CC) $(SERVFLAGS) -c -o $@ $<
-		
-spcacat.o:	spcacat.c
-		$(CC) $(SERVFLAGS) -c -o $@ $<
-	
-spcav4l.o:	spcav4l.c spcav4l.h
-		$(CC) $(SERVFLAGS) -c -o $@ $<
-		
-utils.o:	utils.c utils.h
-		$(CC) $(SERVFLAGS) -c -o $@ $<
-		
-picture.o:	picture.c picture.h
-		$(CC) $(SERVFLAGS) -c -o $@ $<
-		
-pargpio.o:	pargpio.c pargpio.h
-		$(CC) $(SERVFLAGS) -c -o $@ $<
-		
-tcputils.o:	tcputils.c tcputils.h
-		$(CC) $(SERVFLAGS) -c -o $@ $<
-		
-encoder.o:	encoder.c encoder.h
-		$(CC) $(SERVFLAGS) -c -o $@ $<
-		
-huffman.o:	huffman.c huffman.h
-		$(CC) $(SERVFLAGS) -c -o $@ $<
-		
-marker.o:	marker.c marker.h
-		$(CC) $(SERVFLAGS) -c -o $@ $<
-		
-quant.o:	quant.c quant.h
-		$(CC) $(SERVFLAGS) -c -o $@ $<
-		
 install_spcaserv: spcaserv
-	$(INSTALL) -s -m 755 -g root -o root spcaserv $(BIN) 
+	$(INSTALL) -m 755 -d $(DESTDIR)$(BIN)
+	$(INSTALL) -m 755 -g root -o root spcaserv $(DESTDIR)$(BIN) 
 	
 install_spcacat: spcacat	
-	$(INSTALL) -s -m 755 -g root -o root spcacat $(BIN)
+	$(INSTALL) -m 755 -d $(DESTDIR)$(BIN)
+	$(INSTALL) -m 755 -g root -o root spcacat $(DESTDIR)$(BIN)
 
 install_spcaview: spcaview
-	 $(INSTALL) -s -m 755 -g root -o root spcaview $(BIN)
+	$(INSTALL) -m 755 -d $(DESTDIR)$(BIN)
+	$(INSTALL) -m 755 -g root -o root spcaview $(DESTDIR)$(BIN)
 	 
 install: spcaview spcaserv spcacat
-	$(INSTALL) -s -m 755 -g root -o root spcaview $(BIN) 
-	$(INSTALL) -s -m 755 -g root -o root spcaserv $(BIN) 
-	$(INSTALL) -s -m 755 -g root -o root spcacat $(BIN) 
+	$(INSTALL) -m 755 -d $(DESTDIR)$(BIN)
+	$(INSTALL) -m 755 -g root -o root spcaview $(DESTDIR)$(BIN) 
+	$(INSTALL) -m 755 -g root -o root spcaserv $(DESTDIR)$(BIN) 
+	$(INSTALL) -m 755 -g root -o root spcacat $(DESTDIR)$(BIN)