# Makefile for GPS Test Tool (PC Application) CC = gcc CFLAGS = -Wall -Wextra -g -O2 -I. -I../soft -DPC_BUILD LDFLAGS = -lm TARGET = gps-test-tool SOURCES = main.c gpx_wrapper.c nmea_actual_wrapper.c syslog_wrapper.c OBJECTS = $(SOURCES:.c=.o) TEST_MALFORMED = test-malformed TEST_MALFORMED_OBJECTS = test_malformed.o gpx_wrapper.o nmea_actual_wrapper.o syslog_wrapper.o .PHONY: all clean run-test-malformed all: $(TARGET) $(TARGET): $(OBJECTS) $(CC) $(OBJECTS) -o $(TARGET) $(LDFLAGS) @echo "" @echo "Build complete! Run with:" @echo " ./$(TARGET) " $(TEST_MALFORMED): $(TEST_MALFORMED_OBJECTS) $(CC) $(TEST_MALFORMED_OBJECTS) -o $(TEST_MALFORMED) $(LDFLAGS) run-test-malformed: $(TEST_MALFORMED) ./$(TEST_MALFORMED) malformed_test.nmea %.o: %.c avr_compat.h $(CC) $(CFLAGS) -c $< -o $@ clean: rm -f $(OBJECTS) $(TEST_MALFORMED) test_malformed.o $(TARGET) output_*.gpx debug_*.txt test: $(TARGET) @echo "Running test with sample NMEA data..." @echo "Creating sample NMEA file..." @echo '$$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A' > test.nmea @echo '$$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47' >> test.nmea @echo '$$GPRMC,123520,A,4807.039,N,01131.001,E,022.4,084.4,230394,003.1,W*60' >> test.nmea @echo '$$GPGGA,123520,4807.039,N,01131.001,E,1,08,0.9,546.2,M,46.9,M,,*48' >> test.nmea ./$(TARGET) test.nmea @echo "" @echo "Test complete! Check output_*.gpx and debug_*.txt" .PHONY: help help: @echo "GPS Test Tool - Build System" @echo "" @echo "Targets:" @echo " all (default) - Build the gps-test-tool executable" @echo " clean - Remove built files and output" @echo " test - Build and run with sample data" @echo " help - Show this help message" @echo "" @echo "Usage:" @echo " make # Build" @echo " make test # Build and test" @echo " ./gps-test-tool # Run"