main.c
main()
{
hello();
}
hello.c
#include <stdio.h>
hello()
{
printf("Hello, World!\n");
}
Makefile
hello: main.o hello.o
helloがターゲット
vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ make
cc -c -o hello.o hello.c
cc -c -o main.o main.c
cc hello.o main.o -o hello
vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ ./hello
Hello, World!
時間かかったー、これだけに30分費やした。。
vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ touch hello.c
vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ make
cc -c -o hello.o hello.c
cc hello.o main.o -o hello
ほう。
hello: main.o hello.o clean: rm -f *.o hello
vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ make clean
rm -f *.o hello
vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ ls
hello.c main.c Makefile
all, test, install, cleanなどがある