Skip to content

Commit

Permalink
allow cross-compiling of libfec
Browse files Browse the repository at this point in the history
init_rs_char is used both by libfec and during build process to generate
some items. we need to build it both ways so we can use it natively and
by cross-compiling target
  • Loading branch information
brian-armstrong committed Feb 23, 2016
1 parent 1114a9c commit b802307
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
35 changes: 35 additions & 0 deletions init_rs_char_local.c
@@ -0,0 +1,35 @@
/* Initialize a RS codec
*
* Copyright 2002 Phil Karn, KA9Q
* May be used under the terms of the GNU Lesser General Public License (LGPL)
*/
#include <stdlib.h>

#include "char.h"
#include "rs-common.h"

void free_rs_char(void *p){
struct rs *rs = (struct rs *)p;

free(rs->alpha_to);
free(rs->index_of);
free(rs->genpoly);
free(rs);
}

/* Initialize a Reed-Solomon codec
* symsize = symbol size, bits
* gfpoly = Field generator polynomial coefficients
* fcr = first root of RS code generator polynomial, index form
* prim = primitive element to generate polynomial roots
* nroots = RS code generator polynomial degree (number of roots)
* pad = padding bytes at front of shortened block
*/
void *init_rs_char(int symsize,int gfpoly,int fcr,int prim,
int nroots,int pad){
struct rs *rs;

#include "init_rs.h"

return rs;
}
11 changes: 10 additions & 1 deletion makefile.in
Expand Up @@ -145,14 +145,23 @@ ccsds_tab.o: ccsds_tab.c
ccsds_tab.c: gen_ccsds
./gen_ccsds > ccsds_tab.c

gen_ccsds: gen_ccsds.o init_rs_char.o
gen_ccsds: gen_ccsds.o init_rs_char_local.o
gcc -o $@ $^

gen_ccsds.o: gen_ccsds.c
gcc $(CFLAGS) -c -o $@ $<

init_rs_char_local.o: init_rs_char_local.c
gcc $(CFLAGS) -c -o $@ $<

ccsds_tal.o: ccsds_tal.c

gen_ccsds_tal: gen_ccsds_tal.o
gcc -o $@ $^

gen_ccsds_tal.o: gen_ccsds_tal.c
gcc $(CFLAGS) -c -o $@ $<

ccsds_tal.c: gen_ccsds_tal
./gen_ccsds_tal > ccsds_tal.c

Expand Down

0 comments on commit b802307

Please sign in to comment.