Description: Fix the build system Author: Simon Richter Last-Update: 2013-04-04 Index: langford-0.0.20130228/Makefile =================================================================== --- langford-0.0.20130228.orig/Makefile +++ langford-0.0.20130228/Makefile @@ -1,33 +1,11 @@ obj-m = langford.o KVERSION = $(shell uname -r) -all: langford.ko langford_util langford_adc_util +all: libs langford_util langford_adc_util langford.ko: langford.c export CCFLAGS="-ansi -Wall" - sudo make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules - -install: langford.ko langford_util langford_adc_util - #Ensure module recompilation everytime it needs to be installed. - #(Prevents module version errors after kernel upgrades.) - -sudo rm -f langford.ko - -sudo rm -rf /dev/langford - -sudo modprobe -r langford - make langford.ko - sudo cp langford.ko /lib/modules/`uname -r`/kernel/drivers/misc - sudo depmod -a - sudo modprobe langford -#Allow some time for driver to finish loading. If driver does not complete loading, no character device will be registered and mknod will fail. - sleep 3 - sync - sudo cp langford_util /usr/bin - sudo cp langford_adc_util /usr/bin - sudo cp langford_init /usr/bin -#Create langford group, if not already. - -sudo groupadd langford - sudo chmod a+rx /usr/bin/langford_util - make -C libs/ install - echo "Remember to run langford_init in order to initialize the device at /dev/langford" + $(MAKE) -C /lib/modules/$(KVERSION)/build M=$(PWD) modules langford_util: langford_util.cpp $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ @@ -36,23 +14,16 @@ langford_adc_util: langford_adc_util.cpp $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ libs: - make -f libs/Makefile + $(MAKE) -C libs/ clean: - -sudo make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean - -sudo rm -rf langford.ko.gz langford_util langford_adc_util - make -C libs/ clean + #$(MAKE) -C /lib/modules/$(KVERSION)/build M=$(PWD) clean + $(RM) -r langford.ko.gz langford_util langford_adc_util + $(MAKE) -C libs/ clean distclean: clean - -sudo make -C ./ clean - -sudo rm -rf .tmp* - -sudo rm -rf *~ - #-sudo rm modules.order Module.symvers - -uninstall: - -sudo rm /usr/bin/langford_util - -sudo rm /usr/bin/langford_init - -sudo rm /usr/bin/langford_adc_util - # Remove langford group - -sudo groupdel langford - make -C libs/ uninstall + $(MAKE) -C ./ clean + $(RM) -r .tmp* + $(RM) -r *~ + +.PHONY: all libs clean distclean Index: langford-0.0.20130228/libs/Makefile =================================================================== --- langford-0.0.20130228.orig/libs/Makefile +++ langford-0.0.20130228/libs/Makefile @@ -10,13 +10,6 @@ langford_rf_fsynth: $(FSYNTHSRC) langford_rx_rf_bb_vga: $(VGASRC) $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ -install: langford_rf_fsynth langford_rx_rf_bb_vga - sudo cp langford_rx_rf_bb_vga langford_rf_fsynth /usr/bin - sudo chmod a+rx /usr/bin/langford_rx_rf_bb_vga /usr/bin/langford_rf_fsynth - -uninstall: - -sudo rm -rf /usr/bin/langford_rx_rf_bb_vga /usr/bin/langford_rf_fsynth - -clean: - -sudo rm -rf langford_rf_fsynth langford_rx_rf_bb_vga +clean distclean: + $(RM) langford_rf_fsynth langford_rx_rf_bb_vga