Compile own driver. How to Makefile?

More
8 years 10 months ago #102682 by AndrewHsasku
I am trying to prepare own driver for canopen.
I have no idea how (where) to compile my files.
My makefile, based on EtherCAT HAL makefile, looks like below:
Code:
.PHONY: install clean EXTRA_CFLAGS := $(filter-out -Wframe-larger-than=%,$(EXTRA_CFLAGS)) install: canopen_driver echo "DESTDIR = $(DESTDIR)" echo "EMC2_HOME = $(EMC2_HOME)" mkdir -p $(DESTDIR)$(EMC2_HOME)/bin cp canopen_driver $(DESTDIR)$(EMC2_HOME)/bin/ canopen_driver: canopen_driver.o $(CC) -o $@ $< -Wl,-rpath,$(LIBDIR) -L$(LIBDIR) -llinuxcnchal -lexpat %.o: %.c $(CC) -o $@ $(EXTRA_CFLAGS) -URTAPI -U__MODULE__ -DULAPI -Os -c $< clean: rm -f *.so *.ko *.o rm -f *.mod.c .*.cmd rm -f modules.order Module.symvers rm -rf .tmp_versions rm -f canopen_driver

Of course, resulting in error in first line of my code where I import hal.h. File is not found.
Please attach example makefile.

Please Log in to join the conversation.

More
8 years 10 months ago #102727 by andypugh
You could try compiling with halcompile, that might work.

Otherwise I have always tended to accept adding the new driver to the source tree and then adding it to the main LinuxCNC Makefiles. If you intend to add the driver to LinuxCNC then this is probably the best way to be sure that it is compatible anyway.

Please Log in to join the conversation.

Time to create page: 0.216 seconds
Powered by Kunena Forum