# Makefile for modbus_tcp_to_rtu program # Compiler CC = arm-linux-gnueabihf-gcc # Compiler flags CFLAGS = -Wall -Wextra -O2 # Target executable TARGET = modbus_tcp_to_rtu # Source files SRCS = tcp2rtu.c # Object files OBJS = $(SRCS:.c=.o) # Default target all: $(TARGET) # Build target executable $(TARGET): $(OBJS) $(CC) $(CFLAGS) -o $(TARGET) $(OBJS) # Compile source files to object files %.o: %.c $(CC) $(CFLAGS) -c $< -o $@ # Clean up build files clean: rm -f $(OBJS) $(TARGET) # Phony targets .PHONY: all clean