Makefile 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. GUI = gps-test-tool-gui
  9. GUI_CFLAGS = -Wall -Wextra -g -O2 $(shell pkg-config --cflags gtk+-3.0 libsoup-3.0)
  10. GUI_LDFLAGS = $(shell pkg-config --libs gtk+-3.0 libsoup-3.0) -lm
  11. TEST_MALFORMED = test-malformed
  12. TEST_MALFORMED_OBJECTS = test_malformed.o gpx_wrapper.o nmea_actual_wrapper.o syslog_wrapper.o
  13. .PHONY: all gui clean run-test-malformed
  14. all: $(TARGET)
  15. $(TARGET): $(OBJECTS)
  16. $(CC) $(OBJECTS) -o $(TARGET) $(LDFLAGS)
  17. @echo ""
  18. @echo "Build complete! Run with:"
  19. @echo " ./$(TARGET) <input.nmea>"
  20. gui: $(TARGET) $(GUI)
  21. $(GUI): gui.c
  22. $(CC) $(GUI_CFLAGS) gui.c -o $(GUI) $(GUI_LDFLAGS)
  23. $(TEST_MALFORMED): $(TEST_MALFORMED_OBJECTS)
  24. $(CC) $(TEST_MALFORMED_OBJECTS) -o $(TEST_MALFORMED) $(LDFLAGS)
  25. run-test-malformed: $(TEST_MALFORMED)
  26. ./$(TEST_MALFORMED) malformed_test.nmea
  27. %.o: %.c
  28. $(CC) $(CFLAGS) -c $< -o $@
  29. clean:
  30. rm -f $(OBJECTS) $(TEST_MALFORMED) test_malformed.o $(TARGET) $(GUI) output_*.gpx debug_*.txt
  31. test: $(TARGET)
  32. @echo "Running test with sample NMEA data..."
  33. @echo "Creating sample NMEA file..."
  34. @echo '$$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A' > test.nmea
  35. @echo '$$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47' >> test.nmea
  36. @echo '$$GPRMC,123520,A,4807.039,N,01131.001,E,022.4,084.4,230394,003.1,W*60' >> test.nmea
  37. @echo '$$GPGGA,123520,4807.039,N,01131.001,E,1,08,0.9,546.2,M,46.9,M,,*48' >> test.nmea
  38. ./$(TARGET) test.nmea
  39. @echo ""
  40. @echo "Test complete! Check output_*.gpx and debug_*.txt"
  41. .PHONY: help
  42. help:
  43. @echo "GPS Test Tool - Build System"
  44. @echo ""
  45. @echo "Targets:"
  46. @echo " all (default) - Build the gps-test-tool executable"
  47. @echo " gui - Also build gps-test-tool-gui (needs GTK3, libsoup3)"
  48. @echo " clean - Remove built files and output"
  49. @echo " test - Build and run with sample data"
  50. @echo " help - Show this help message"
  51. @echo ""
  52. @echo "Usage:"
  53. @echo " make # Build"
  54. @echo " make test # Build and test"
  55. @echo " ./gps-test-tool <input.nmea> # Run"
  56. @echo " ./gps-test-tool-gui [input.nmea] # Run GUI"