Reputation: 23
To perform an experiment I want to modify the assembly code of the OpenWRT Project (by inserting NOPs between the regular, meaningful code). Thous I need to create the assembly files (.s files) by compiling with gcc's -S flag in the first run, execute a shell script modifying the assembly files and call the linker in the third step to create the executable binaries. Beside step 2, is there a way to accomplish steps 1 & 3 by an appropriate make file modification/configuration, i.e. create one make file for compiling (creating .s files) and another to conduct linking?
Thanks for enlightenment & Happy a new year! :)
Upvotes: 2
Views: 1590
Reputation: 360
use this syntax:
target [target...] : [dependent ....]
[ command ...]
example:
%.S: %.c
$(CC) -S $@ -c $<
%.o: %.S
$(CC) -o $@ -c $<
which means to build the target foo.o make should build foo.S and for foo.S build foo.c $@ means target name $< means targets first dependency
Upvotes: 1