makefile 530 B

12345678910111213141516171819202122232425262728293031323334
  1. # Makefile for modbus_tcp_to_rtu program
  2. # Compiler
  3. CC = arm-linux-gnueabihf-gcc
  4. # Compiler flags
  5. CFLAGS = -Wall -Wextra -O2
  6. # Target executable
  7. TARGET = modbus_tcp_to_rtu
  8. # Source files
  9. SRCS = tcp2rtu.c
  10. # Object files
  11. OBJS = $(SRCS:.c=.o)
  12. # Default target
  13. all: $(TARGET)
  14. # Build target executable
  15. $(TARGET): $(OBJS)
  16. $(CC) $(CFLAGS) -o $(TARGET) $(OBJS)
  17. # Compile source files to object files
  18. %.o: %.c
  19. $(CC) $(CFLAGS) -c $< -o $@
  20. # Clean up build files
  21. clean:
  22. rm -f $(OBJS) $(TARGET)
  23. # Phony targets
  24. .PHONY: all clean