CC = cc
TARGET= main
CFLAGS= -O2 -Wall
OBJ = main.o  functions.o initialize.o correct_center.o post_get.o post_approach.o thread_func.o pwm.o both.o encoder.o post_to_post.o first_move.o post_approach2.o new_post_search.c
LIBS= -lm -pthread
HEADER = control.h  func_extern.h  irs_ts_ws.h  post.h  pwm_enc.h  uss.h lcd_nr.h

all: $(TARGET)

$(TARGET):$(OBJ) 
	$(CC) $(CFLAGS) -o $(TARGET) $(OBJ) $(LIBS)

%.o:%.c $(HEADER)
	$(CC) $(CFLAGS) -c $< -o $@

clean:
	rm -f $(TARGET) *.o
