I was trying to write a makefile for a multithreaded program that has a master process that executes two slave processes. There is a library too (used by master and slaves).

I am not sure how i should compile the library.

But sometimes, modifying one on the files, the makefile command doesn't recompile it (it says has nothing to do with 'all').

I tried writing it like this (Ubuntu):

```
all:executable

executable: slave1 slave 2 executable.o
  gcc -o executable executable.o 

slave1: slave1.o
  gcc -o slave1 slave1.o

slave2: slave2.o
  gcc -o slave2 slave2.o

library.o : library.c
  gcc -c library.c

executable.o: executable.c
  gcc -c executable.c

slave1.o: slave1.c
   gcc -c slave1.c

slave2.o: slave2.c
   gcc -c slave2.c

```

I also tried:

```
all:executable

executable: slave1 slave2
gcc -g -o executable executable.c

slave1:
gcc -g -o slave1 slave1.c library.c-lm

slave2:
gcc -g -o slave2 slave2.c library.c -lm

```

The program structure is so defined:

executable.c,slave1.c,slave2.c,library.c include library.h

executable runs slave1 and slave 2