[Linux] make - 3
이젠 Makefile 을 src 에 두지 않고 아래와 같이 따로 상위 폴더로 분리 해 보자 /* include/my_math.h */ int add ( int x, int y) ; int subtract ( int x, int y) ; int multiply ( int x, int y) ; int divide ( int x, int y) ; /* src/main.c */ # include <stdio.h> # include <pthread.h> # include <my_math.h> void * thread_func ( void *data) { printf ( "[%s]\n" , __func__); printf ( "%d\n" , add( 10 , 5 )); printf ( "%d\n" , subtract( 10 , 5 )); printf ( "%d\n" , multiply( 10 , 5 )); printf ( "%d\n" , divide( 10 , 5 )); return 0 ; } int main ( void ) { pthread_t thread; pthread_create(&thread, 0 , thread_func, 0 ); pthread_join(thread, 0 ); return 0 ; } /* src/add.c */ # include <my_math.h> int add ( int x, int y) { return x + y; } //----------------------------------------------------------------------------------