I write a makefile and I want it to execute the program for some reasons after compiling.
But it is too slow when I only use the command 'make'.So I add argument '-j' to speed up.
I just want it to compile all files first and run the program compiled automatically,but it run the program first before the compilation.
How can I control the order partly?
makefile
all:test run
test:test1.o test2.o test3.o
gcc test1.o test2.o test3.o -o test
test1:test1.c
gcc -c test1.c
test2:test2.c
gcc -c test2.c
test3:test3.c
gcc -c test3.c
run:
./test
It may run ./test
first before it compile completely.