1# Makefile prototype for configure 2# Copyright 2004 Phil Karn, KA9Q 3# May be used under the terms of the GNU Lesser General Public License (LGPL) 4 5# @configure_input@ 6srcdir = @srcdir@ 7prefix = @prefix@ 8exec_prefix=@exec_prefix@ 9VPATH = @srcdir@ 10CC=@CC@ 11LIBS=@MLIBS@ fec.o sim.o viterbi27.o viterbi27_port.o viterbi29.o viterbi29_port.o \ 12 viterbi39.o viterbi39_port.o \ 13 viterbi615.o viterbi615_port.o encode_rs_char.o encode_rs_int.o encode_rs_8.o \ 14 decode_rs_char.o decode_rs_int.o decode_rs_8.o \ 15 init_rs_char.o init_rs_int.o ccsds_tab.o \ 16 encode_rs_ccsds.o decode_rs_ccsds.o ccsds_tal.o \ 17 dotprod.o dotprod_port.o \ 18 peakval.o peakval_port.o \ 19 sumsq.o sumsq_port.o 20 21CFLAGS=@CFLAGS@ -I. -Wall @ARCH_OPTION@ 22 23SHARED_LIB=@SH_LIB@ 24 25all: libfec.a $(SHARED_LIB) 26 27test: vtest27 vtest29 vtest39 vtest615 rstest dtest sumsq_test peaktest 28 @echo "Correctness tests:" 29 ./vtest27 -e 3.0 -n 1000 -v 30 ./vtest29 -e 2.5 -n 1000 -v 31 ./vtest39 -e 2.5 -n 1000 -v 32 ./vtest615 -e 1.0 -n 100 -v 33 ./rstest 34 ./dtest 35 ./sumsq_test 36 ./peaktest 37 @echo "Speed tests:" 38 ./vtest27 39 ./vtest29 40 ./vtest39 41 ./vtest615 42 43install: all 44 mkdir -p @libdir@ 45 install -m 644 -p $(SHARED_LIB) libfec.a @libdir@ 46# (cd @libdir@;ln -f -s $(SHARED_LIB) libfec.so) 47 @REBIND@ 48 mkdir -p @includedir@ 49 install -m 644 -p fec.h @includedir@ 50 mkdir -m 0755 -p @mandir@/man3 51 install -m 644 -p simd-viterbi.3 rs.3 dsp.3 @mandir@/man3 52 53peaktest: peaktest.o libfec.a 54 gcc -g -o $@ $^ 55 56sumsq_test: sumsq_test.o libfec.a 57 gcc -g -o $@ $^ 58 59dtest: dtest.o libfec.a 60 gcc -g -o $@ $^ -lm 61 62vtest27: vtest27.o libfec.a 63 gcc -g -o $@ $^ -lm 64 65vtest29: vtest29.o libfec.a 66 gcc -g -o $@ $^ -lm 67 68vtest39: vtest39.o libfec.a 69 gcc -g -o $@ $^ -lm 70 71vtest615: vtest615.o libfec.a 72 gcc -g -o $@ $^ -lm 73 74rstest: rstest.o libfec.a 75 gcc -g -o $@ $^ 76 77rs_speedtest: rs_speedtest.o libfec.a 78 gcc -g -o $@ $^ 79 80# for some reason, the test programs without args segfault on the PPC with -O2 optimization. Dunno why - compiler bug? 81vtest27.o: vtest27.c fec.h 82 gcc -g -c $< 83 84vtest29.o: vtest29.c fec.h 85 gcc -g -c $< 86 87vtest39.o: vtest39.c fec.h 88 gcc -g -c $< 89 90vtest615.o: vtest615.c fec.h 91 gcc -g -c $< 92 93libfec.a: $(LIBS) 94 ar rv $@ $^ 95 ranlib libfec.a 96 97# for Darwin 98libfec.dylib: $(LIBS) 99 $(CC) -dynamiclib -install_name $@ -o $@ $^ 100 101# for Linux et al 102libfec.so: $(LIBS) 103 gcc -shared -Xlinker -soname=$@ -o $@ -Wl,-whole-archive $^ -Wl,-no-whole-archive -lc 104 105dotprod.o: dotprod.c fec.h 106 107dotprod_port.o: dotprod_port.c fec.h 108 109viterbi27.o: viterbi27.c fec.h 110 111viterbi27_port.o: viterbi27_port.c fec.h 112 113viterbi29.o: viterbi29.c fec.h 114 115viterbi39.o: viterbi39.c fec.h 116 117viterbi39_port.o: viterbi39_port.c fec.h 118 119viterbi39_sse2.o: viterbi39_sse2.c fec.h 120 121viterbi39_sse.o: viterbi39_sse.c fec.h 122 123viterbi39_mmx.o: viterbi39_mmx.c fec.h 124 125encode_rs_char.o: encode_rs_char.c char.h rs-common.h 126 127encode_rs_int.o: encode_rs_int.c int.h rs-common.h 128 129encode_rs_8.o: encode_rs_8.c fixed.h 130 131encode_rs_av.o: encode_rs_av.c fixed.h 132 133decode_rs_char.o: decode_rs_char.c char.h rs-common.h 134 135decode_rs_int.o: decode_rs_int.c int.h rs-common.h 136 137decode_rs_8.o: decode_rs_8.c fixed.h 138 139init_rs_char.o: init_rs_char.c char.h rs-common.h 140 141init_rs_int.o: init_rs_int.c int.h rs-common.h 142 143ccsds_tab.o: ccsds_tab.c 144 145ccsds_tab.c: gen_ccsds 146 ./gen_ccsds > ccsds_tab.c 147 148gen_ccsds: gen_ccsds.o init_rs_char.o 149 gcc -o $@ $^ 150 151gen_ccsds.o: gen_ccsds.c 152 gcc $(CFLAGS) -c -o $@ $< 153 154ccsds_tal.o: ccsds_tal.c 155 156ccsds_tal.c: gen_ccsds_tal 157 ./gen_ccsds_tal > ccsds_tal.c 158 159exercise_char.o: exercise.c 160 gcc $(CFLAGS) -c -o $@ $< 161 162exercise_int.o: exercise.c 163 gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $< 164 165exercise_8.o: exercise.c 166 gcc -DFIXED=1 $(CFLAGS) -c -o $@ $< 167 168exercise_ccsds.o: exercise.c 169 gcc -DCCSDS=1 $(CFLAGS) -c -o $@ $< 170 171viterbi27.o: viterbi27.c fec.h 172 173viterbi27_port.o: viterbi27_port.c fec.h 174 175viterbi27_av.o: viterbi27_av.c fec.h 176 177viterbi27_mmx.o: viterbi27_mmx.c fec.h 178 gcc $(CFLAGS) -mmmx -c -o $@ $< 179 180viterbi27_sse.o: viterbi27_sse.c fec.h 181 gcc $(CFLAGS) -msse -c -o $@ $< 182 183viterbi27_sse2.o: viterbi27_sse2.c fec.h 184 gcc $(CFLAGS) -msse2 -c -o $@ $< 185 186viterbi29.o: viterbi29.c fec.h 187 188viterbi29_port.o: viterbi29_port.c fec.h 189 190viterbi29_av.o: viterbi29_av.c fec.h 191 192viterbi29_mmx.o: viterbi29_mmx.c fec.h 193 gcc $(CFLAGS) -mmmx -c -o $@ $< 194 195viterbi29_sse.o: viterbi29_sse.c fec.h 196 gcc $(CFLAGS) -msse -c -o $@ $< 197 198viterbi29_sse2.o: viterbi29_sse2.c fec.h 199 gcc $(CFLAGS) -msse2 -c -o $@ $< 200 201viterbi39.o: viterbi39.c fec.h 202 203viterbi39_port.o: viterbi39_port.c fec.h 204 205viterbi39_av.o: viterbi39_av.c fec.h 206 207viterbi39_mmx.o: viterbi39_mmx.c fec.h 208 gcc $(CFLAGS) -mmmx -c -o $@ $< 209 210viterbi39_sse.o: viterbi39_sse.c fec.h 211 gcc $(CFLAGS) -msse -c -o $@ $< 212 213viterbi39_sse2.o: viterbi39_sse2.c fec.h 214 gcc $(CFLAGS) -msse2 -c -o $@ $< 215 216viterbi615.o: viterbi615.c fec.h 217 218viterbi615_port.o: viterbi615_port.c fec.h 219 220viterbi615_av.o: viterbi615_av.c fec.h 221 222viterbi615_mmx.o: viterbi615_mmx.c fec.h 223 gcc $(CFLAGS) -mmmx -c -o $@ $< 224 225viterbi615_sse.o: viterbi615_sse.c fec.h 226 gcc $(CFLAGS) -msse -c -o $@ $< 227 228viterbi615_sse2.o: viterbi615_sse2.c fec.h 229 gcc $(CFLAGS) -msse2 -c -o $@ $< 230 231cpu_mode_x86.o: cpu_mode_x86.c fec.h 232 233cpu_mode_ppc.o: cpu_mode_ppc.c fec.h 234 235 236clean: 237 rm -f *.o $(SHARED_LIB) *.a rs_speedtest peaktest sumsq_test dtest vtest27 vtest29 vtest39 vtest615 rstest ccsds_tab.c ccsds_tal.c gen_ccsds gen_ccsds_tal core 238 rm -rf autom4te.cache 239 240distclean: clean 241 rm -f config.log config.cache config.status config.h makefile 242 243