Makefile 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Makefile for GPS Test Tool (PC Application)
  2. CC = gcc
  3. CFLAGS = -Wall -Wextra -g -O2 -I. -I../soft -DPC_BUILD
  4. LDFLAGS = -lm
  5. TARGET = gps-test-tool
  6. SOURCES = main.c gpx_wrapper.c nmea_actual_wrapper.c syslog_wrapper.c autopause_wrapper.c
  7. OBJECTS = $(SOURCES:.c=.o)
  8. TEST_MALFORMED = test-malformed
  9. TEST_MALFORMED_OBJECTS = test_malformed.o gpx_wrapper.o nmea_actual_wrapper.o syslog_wrapper.o
  10. .PHONY: all clean run-test-malformed
  11. all: $(TARGET)
  12. $(TARGET): $(OBJECTS)
  13. $(CC) $(OBJECTS) -o $(TARGET) $(LDFLAGS)
  14. @echo ""
  15. @echo "Build complete! Run with:"
  16. @echo " ./$(TARGET) <input.nmea>"
  17. $(TEST_MALFORMED): $(TEST_MALFORMED_OBJECTS)
  18. $(CC) $(TEST_MALFORMED_OBJECTS) -o $(TEST_MALFORMED) $(LDFLAGS)
  19. run-test-malformed: $(TEST_MALFORMED)
  20. ./$(TEST_MALFORMED) malformed_test.nmea
  21. %.o: %.c
  22. $(CC) $(CFLAGS) -c $< -o $@
  23. clean:
  24. rm -f $(OBJECTS) $(TEST_MALFORMED) test_malformed.o $(TARGET) output_*.gpx debug_*.txt
  25. test: $(TARGET)
  26. @echo "Running test with sample NMEA data..."
  27. @echo "Creating sample NMEA file..."
  28. @echo '$$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A' > test.nmea
  29. @echo '$$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47' >> test.nmea
  30. @echo '$$GPRMC,123520,A,4807.039,N,01131.001,E,022.4,084.4,230394,003.1,W*60' >> test.nmea
  31. @echo '$$GPGGA,123520,4807.039,N,01131.001,E,1,08,0.9,546.2,M,46.9,M,,*48' >> test.nmea
  32. ./$(TARGET) test.nmea
  33. @echo ""
  34. @echo "Test complete! Check output_*.gpx and debug_*.txt"
  35. .PHONY: help
  36. help:
  37. @echo "GPS Test Tool - Build System"
  38. @echo ""
  39. @echo "Targets:"
  40. @echo " all (default) - Build the gps-test-tool executable"
  41. @echo " clean - Remove built files and output"
  42. @echo " test - Build and run with sample data"
  43. @echo " help - Show this help message"
  44. @echo ""
  45. @echo "Usage:"
  46. @echo " make # Build"
  47. @echo " make test # Build and test"
  48. @echo " ./gps-test-tool <input.nmea> # Run"