[OpenSource_GPS] Linux OSGPS 2.x Makefile

Clifford Kelley cwkelley at earthlink.net
Sat Dec 23 21:15:26 PST 2006

After looking at the .tar file for OSGPS 2.1 it appears that for some reason the all important makefile was not included.  It is in the CVS but since it is small I decided to send it out to the group.

In addition I'd like to wish you all a Merry Christmas and a Happy New Year.

Best regards,

-------------- next part --------------
# To build modules outside of the kernel tree, we run "make"
# in the kernel source tree; the Makefile these then includes this
# Makefile once again.
# This conditional selects whether we are being included from the
# kernel Makefile or not.
ifeq ($(PATCHLEVEL),)

    # Assume the source tree is where the running kernel was built
    # You should set KERNELDIR in the environment if it's elsewhere
    KERNELDIR ?= /lib/modules/$(shell uname -r)/build
    # The current directory is passed to sub-makes as argument
    PWD := $(shell pwd)

SRC=  gpsfuncs.c gpsrcvr.c nav_fix.c linuxusr.c nmea.c FwInter.c rinex.c
GUSRC=gpsfuncs.c gpsrcvr.c nav_fix.c interfac.c
# NMEA.c serport.c FwInter.c

CFLAGS=-g3 -O3 -Wall -W -pedantic -D_GNU_SOURCE -Werror

all: .depend gpsrcvr regtest modules 90-osgps.rules

	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules

	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install

gpsrcvr: $(SRC:.c=.o)
	$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)

gpsuser: $(GUSRC:.c=.o)
	$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)

	echo 'KERNEL=="gps.status",     NAME="gps/status", MODE="0666"' > $@
	echo 'KERNEL=="gps.measurement",NAME="gps/measurement", MODE="0666"' >> $@
	echo 'KERNEL=="gps.data",       NAME="gps/data", MODE="0666"' >> $@

install: modules_install
	cp 90-osgps.rules /etc/udev/rules.d/

	$(RM) -r *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
	$(RM) gpsrcvr regtest *.o *~ 
	$(RM) *.lib *.obj *.exe *.exe

	$(RM) $@
	gcc -MM $(CFLAGS) $(SRC) > $@

.PHONY: modules modules_install clean depend

include .depend

    # called from kernel build system: just declare what our modules are
    gp2021km-objs := linuxmod.o gp2021.o gpsisr.o interfac.o
    obj-m := gp2021km.o

More information about the opensource_gps mailing list