Home | History | Annotate | Download | only in fec
      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@
      6 srcdir = @srcdir@
      7 prefix = @prefix@
      8 exec_prefix=@exec_prefix@
      9 VPATH = @srcdir@
     10 CC=@CC@
     11 LIBS=@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 
     21 CFLAGS=@CFLAGS@ -I. -Wall @ARCH_OPTION@
     22 
     23 SHARED_LIB=@SH_LIB@
     24 
     25 all: libfec.a $(SHARED_LIB)
     26 
     27 test: 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 
     43 install: 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 
     53 peaktest: peaktest.o libfec.a
     54 	gcc -g -o $@ $^
     55 
     56 sumsq_test: sumsq_test.o libfec.a
     57 	gcc -g -o $@ $^
     58 
     59 dtest: dtest.o libfec.a
     60 	gcc -g -o $@ $^ -lm
     61 
     62 vtest27: vtest27.o libfec.a
     63 	gcc -g -o $@ $^ -lm
     64 
     65 vtest29: vtest29.o libfec.a
     66 	gcc -g -o $@ $^ -lm
     67 
     68 vtest39: vtest39.o libfec.a
     69 	gcc -g -o $@ $^ -lm
     70 
     71 vtest615: vtest615.o libfec.a
     72 	gcc -g -o $@ $^ -lm
     73 
     74 rstest: rstest.o libfec.a
     75 	gcc -g -o $@ $^
     76 
     77 rs_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?
     81 vtest27.o: vtest27.c fec.h
     82 	gcc -g -c $<
     83 
     84 vtest29.o: vtest29.c fec.h
     85 	gcc -g -c $<
     86 
     87 vtest39.o: vtest39.c fec.h
     88 	gcc -g -c $<
     89 
     90 vtest615.o: vtest615.c fec.h
     91 	gcc -g -c $<
     92 
     93 libfec.a: $(LIBS)
     94 	ar rv $@ $^
     95 	ranlib libfec.a
     96 
     97 # for Darwin
     98 libfec.dylib: $(LIBS)
     99 	$(CC) -dynamiclib -install_name $@ -o $@ $^
    100 
    101 # for Linux et al
    102 libfec.so: $(LIBS)
    103 	gcc -shared -Xlinker -soname=$@ -o $@ -Wl,-whole-archive $^ -Wl,-no-whole-archive -lc
    104 
    105 dotprod.o: dotprod.c fec.h
    106 
    107 dotprod_port.o: dotprod_port.c fec.h
    108 
    109 viterbi27.o: viterbi27.c fec.h
    110 
    111 viterbi27_port.o: viterbi27_port.c fec.h
    112 
    113 viterbi29.o: viterbi29.c fec.h
    114 
    115 viterbi39.o: viterbi39.c fec.h
    116 
    117 viterbi39_port.o: viterbi39_port.c fec.h
    118 
    119 viterbi39_sse2.o: viterbi39_sse2.c fec.h
    120 
    121 viterbi39_sse.o: viterbi39_sse.c fec.h
    122 
    123 viterbi39_mmx.o: viterbi39_mmx.c fec.h
    124 
    125 encode_rs_char.o: encode_rs_char.c char.h rs-common.h
    126 
    127 encode_rs_int.o: encode_rs_int.c int.h rs-common.h
    128 
    129 encode_rs_8.o: encode_rs_8.c fixed.h
    130 
    131 encode_rs_av.o: encode_rs_av.c fixed.h
    132 
    133 decode_rs_char.o: decode_rs_char.c char.h rs-common.h
    134 
    135 decode_rs_int.o: decode_rs_int.c int.h rs-common.h
    136 
    137 decode_rs_8.o: decode_rs_8.c fixed.h
    138 
    139 init_rs_char.o: init_rs_char.c char.h rs-common.h
    140 
    141 init_rs_int.o: init_rs_int.c int.h rs-common.h
    142 
    143 ccsds_tab.o: ccsds_tab.c
    144 
    145 ccsds_tab.c: gen_ccsds
    146 	./gen_ccsds > ccsds_tab.c
    147 
    148 gen_ccsds: gen_ccsds.o init_rs_char.o
    149 	gcc -o $@ $^
    150 
    151 gen_ccsds.o: gen_ccsds.c
    152 	gcc  $(CFLAGS) -c -o $@ $<
    153 
    154 ccsds_tal.o: ccsds_tal.c
    155 
    156 ccsds_tal.c: gen_ccsds_tal
    157 	./gen_ccsds_tal > ccsds_tal.c
    158 
    159 exercise_char.o: exercise.c
    160 	gcc $(CFLAGS) -c -o $@ $<
    161 
    162 exercise_int.o: exercise.c
    163 	gcc -DBIGSYM=1 $(CFLAGS) -c -o $@ $<
    164 
    165 exercise_8.o: exercise.c
    166 	gcc -DFIXED=1 $(CFLAGS) -c -o $@ $<
    167 
    168 exercise_ccsds.o: exercise.c
    169 	gcc -DCCSDS=1 $(CFLAGS) -c -o $@ $<
    170 
    171 viterbi27.o: viterbi27.c fec.h
    172 
    173 viterbi27_port.o: viterbi27_port.c fec.h
    174 
    175 viterbi27_av.o: viterbi27_av.c fec.h
    176 
    177 viterbi27_mmx.o: viterbi27_mmx.c fec.h
    178 	gcc $(CFLAGS) -mmmx -c -o $@ $<
    179 
    180 viterbi27_sse.o: viterbi27_sse.c fec.h
    181 	gcc $(CFLAGS) -msse -c -o $@ $<
    182 
    183 viterbi27_sse2.o: viterbi27_sse2.c fec.h
    184 	gcc $(CFLAGS) -msse2 -c -o $@ $<
    185 
    186 viterbi29.o: viterbi29.c fec.h
    187 
    188 viterbi29_port.o: viterbi29_port.c fec.h
    189 
    190 viterbi29_av.o: viterbi29_av.c fec.h
    191 
    192 viterbi29_mmx.o: viterbi29_mmx.c fec.h
    193 	gcc $(CFLAGS) -mmmx -c -o $@ $<
    194 
    195 viterbi29_sse.o: viterbi29_sse.c fec.h
    196 	gcc $(CFLAGS) -msse -c -o $@ $<
    197 
    198 viterbi29_sse2.o: viterbi29_sse2.c fec.h
    199 	gcc $(CFLAGS) -msse2 -c -o $@ $<
    200 
    201 viterbi39.o: viterbi39.c fec.h
    202 
    203 viterbi39_port.o: viterbi39_port.c fec.h
    204 
    205 viterbi39_av.o: viterbi39_av.c fec.h
    206 
    207 viterbi39_mmx.o: viterbi39_mmx.c fec.h
    208 	gcc $(CFLAGS) -mmmx -c -o $@ $<
    209 
    210 viterbi39_sse.o: viterbi39_sse.c fec.h
    211 	gcc $(CFLAGS) -msse -c -o $@ $<
    212 
    213 viterbi39_sse2.o: viterbi39_sse2.c fec.h
    214 	gcc $(CFLAGS) -msse2 -c -o $@ $<
    215 
    216 viterbi615.o: viterbi615.c fec.h
    217 
    218 viterbi615_port.o: viterbi615_port.c fec.h
    219 
    220 viterbi615_av.o: viterbi615_av.c fec.h
    221 
    222 viterbi615_mmx.o: viterbi615_mmx.c fec.h
    223 	gcc $(CFLAGS) -mmmx -c -o $@ $<
    224 
    225 viterbi615_sse.o: viterbi615_sse.c fec.h
    226 	gcc $(CFLAGS) -msse -c -o $@ $<
    227 
    228 viterbi615_sse2.o: viterbi615_sse2.c fec.h
    229 	gcc $(CFLAGS) -msse2 -c -o $@ $<
    230 
    231 cpu_mode_x86.o: cpu_mode_x86.c fec.h
    232 
    233 cpu_mode_ppc.o: cpu_mode_ppc.c fec.h
    234 
    235 
    236 clean:
    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 
    240 distclean: clean
    241 	rm -f config.log config.cache config.status config.h makefile
    242 
    243