unix - reconfiguring a Makefile -


i'm little new , trying build rather large project. in particular, source code executing lines

gcc -wall -w   -c -o setitimer-helper.o setitimer-helper.c gcc -lm  setitimer-helper.o   -o setitimer-helper 

this creates linker error because according c: undefined reference floor -lm must come after object files.

i need know in source code can find , rearrange this. think it's in here, i'm unfamiliar unix.

cc = gcc cflags = -wall -w ldflags = -lm  all: setitimer-helper squish-pty squish-unix  %.o: %.c     $(cc) -c $< -o $@  %: %.c     $(cc) $(cflags) $< $(ldflags) -o $@  clean:     rm -f *.o setitimer-helper squish-pty squish-unix 

am correct? if so, how can fix this. if not, should look?

thanks.

change rule build binary put $(ldflags) @ end.

%: %.c     $(cc) $(cflags) $< -o $@ $(ldflags) 

when executed gcc command should like.

gcc -wall -w setitimer-helper.c -o setitimer-helper -lm 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -