@@ -135,7 +135,7 @@ cxx-option = $(shell if $(CXX) $(CXXFLAGS) $(1) -S -o /dev/null -xc++ /dev/null
135135ifeq ($(origin KERNELRELEASE ) ,undefined)
136136# When KERNELRELEASE is not defined, this is the userspace build.
137137# The "modules" target is the gateway to the kernel module build.
138- build-software : userspace modules
138+ build-software : headers userspace modules
139139ifeq ($(RUN_IN_PLACE ) ,yes)
140140ifneq ($(BUILD_SYS ) ,uspace)
141141 @if [ -f ../bin/linuxcnc_module_helper ]; then if ! [ `id -u` = 0 -a -O ../bin/linuxcnc_module_helper -a -u ../bin/linuxcnc_module_helper ]; then $(VECHO) "You now need to run 'sudo make setuid' in order to run in place."; fi; fi
@@ -245,7 +245,7 @@ $(shell $(VECHO) 1>&2 Done reading dependencies)
245245endif
246246
247247# Each directory in $(INCLUDES) is passed as a -I directory when compiling.
248- INCLUDE := $(patsubst % ,-I% , $(INCLUDES ) ) -I$(RTDIR ) /include
248+ INCLUDE := $(patsubst % ,-I% , $(INCLUDES ) ) -I$(RTDIR ) /../ include
249249INCLUDE += $(PYTHON_CPPFLAGS )
250250INCLUDE += $(LIBTIRPC_CFLAGS )
251251
@@ -288,6 +288,7 @@ $(sort $(patsubst %.cpp,objects/%.o,$(filter %.cpp,$(RUCKIG_CXX_FILES)))) : obje
288288 @mkdir -p $(dir $@ )
289289 @rm -f $@
290290 $(Q )$(CXX ) -c $(CXXFLAGS ) $(EXTRAFLAGS ) -std=c++20 \
291+ -I$(BASEPWD ) /emc/tp/ruckig/include \
291292 -MP -MD -MF " ${@: .o=.d} " -MT " $@ " \
292293 $< -o $@
293294
@@ -296,6 +297,7 @@ $(sort $(patsubst %.cc,objects/%.o,$(filter %.cc,$(RUCKIG_CXX_FILES)))) : object
296297 @mkdir -p $(dir $@ )
297298 @rm -f $@
298299 $(Q )$(CXX ) -c $(CXXFLAGS ) $(EXTRAFLAGS ) -std=c++20 \
300+ -I$(BASEPWD ) /emc/tp/ruckig/include \
299301 -MP -MD -MF " ${@: .o=.d} " -MT " $@ " \
300302 $< -o $@
301303
@@ -377,117 +379,46 @@ INFILES = \
377379$(INFILES ) : % : % .in config.status
378380 @./config.status --file=$@
379381
380- build-software : $(INFILES )
382+ build-software : headers $(INFILES )
381383
382384# For each file to be copied to ../include, its location in the source tree
383- # is listed here. Note that due to $(INCLUDE), defined above, the include
384- # files in the source tree are the ones used when building linuxcnc. The copy
385- # in ../include is used when building external components of linuxcnc.
385+ # is listed here.
386+ # Note that due to $(INCLUDE), defined above, the include files in the source
387+ # tree are normally the ones used or not found at all when building linuxcnc if
388+ # you are not aware of the differences between "" and <> includes.
389+ #
390+ # All sources should #include <> (like in #include <rtapi.h>) for these special
391+ # headers in the ../include directory to ensure they are used.
392+ # The *only* exception is those sources that use the include and reside in the
393+ # /same/ source directory as the include. That means that the local version
394+ # should have precedence over the global one.
395+ #
396+ # If you add to these headers, then you must make absolutely sure that they are
397+ # required for out-of-tree components and that the proper #include type is
398+ # used.
399+ #
386400SRCHEADERS := \
401+ hal/hal.h \
402+ hal/drivers/mesa-hostmot2/hostmot2-serial.h \
387403 emc/linuxcnc.h \
388- emc/ini/emcIniFile.hh \
389- emc/ini/iniaxis.hh \
390- emc/ini/inijoint.hh \
391- emc/ini/inispindle.hh \
392- emc/ini/initraj.hh \
393- emc/ini/inihal.hh \
394- emc/kinematics/cubic.h \
395404 emc/kinematics/kinematics.h \
396- emc/kinematics/switchkins.h \
397- emc/kinematics/genhexkins.h \
398- emc/kinematics/genserkins.h \
399- emc/kinematics/pentakins.h \
400- emc/kinematics/pumakins.h \
401- emc/tp/tc.h \
402- emc/tp/tc_types.h \
403- emc/tp/tcq.h \
404- emc/tp/tp.h \
405- emc/tp/tp_types.h \
406- emc/tp/spherical_arc.h \
407- emc/tp/blendmath.h \
408405 emc/motion/emcmotcfg.h \
409- emc/motion/motion.h \
410- emc/motion/homing.h \
411- emc/motion/simple_tp.h \
412- emc/motion/sp_scurve.h \
413- emc/motion/state_tag.h \
414- emc/motion/usrmotintf.h \
415- emc/motion/axis.h \
416- emc/nml_intf/canon.hh \
417- emc/nml_intf/canon_position.hh \
418- emc/nml_intf/emctool.h \
419- emc/nml_intf/emc.hh \
420- emc/nml_intf/emc_nml.hh \
421- emc/nml_intf/emccfg.h \
422- emc/nml_intf/emcglb.h \
423406 emc/nml_intf/emcpos.h \
424407 emc/nml_intf/emcpose.h \
425- emc/nml_intf/interp_return.hh \
426- emc/nml_intf/interpl.hh \
427408 emc/nml_intf/motion_types.h \
428- emc/nml_intf/debugflags.h \
429- emc/rs274ngc/interp_internal.hh \
430- emc/rs274ngc/interp_fwd.hh \
431- emc/rs274ngc/interp_base.hh \
432- emc/rs274ngc/modal_state.hh \
433- emc/rs274ngc/rs274ngc.hh \
434- emc/rs274ngc/saicanon.hh \
435- emc/tooldata/tooldata.hh \
436- hal/hal.h \
437- hal/hal_parport.h \
438- hal/drivers/mesa-hostmot2/hostmot2-serial.h \
439- libnml/buffer/locmem.hh \
440- libnml/buffer/memsem.hh \
441- libnml/buffer/phantom.hh \
442- libnml/buffer/physmem.hh \
443- libnml/buffer/recvn.h \
444- libnml/buffer/rem_msg.hh \
445- libnml/buffer/sendn.h \
446- libnml/buffer/shmem.hh \
447- libnml/buffer/tcpmem.hh \
448- libnml/cms/cms.hh \
449- libnml/cms/cms_aup.hh \
450- libnml/cms/cms_cfg.hh \
451- libnml/cms/cms_dup.hh \
452- libnml/cms/cms_srv.hh \
453- libnml/cms/cms_up.hh \
454- libnml/cms/cms_user.hh \
455- libnml/cms/cms_xup.hh \
456- libnml/cms/cmsdiag.hh \
457- libnml/cms/tcp_opts.hh \
458- libnml/cms/tcp_srv.hh \
459- libnml/inifile/inifile.h \
460- libnml/inifile/inifile.hh \
461- libnml/linklist/linklist.hh \
462- libnml/nml/cmd_msg.hh \
463- libnml/nml/nml.hh \
464- libnml/nml/nml_oi.hh \
465- libnml/nml/nml_srv.hh \
466- libnml/nml/nml_type.hh \
467- libnml/nml/nmldiag.hh \
468- libnml/nml/nmlmsg.hh \
469- libnml/nml/stat_msg.hh \
470- libnml/os_intf/_sem.h \
471- libnml/os_intf/sem.hh \
472- libnml/os_intf/_shm.h \
473- libnml/os_intf/shm.hh \
474- libnml/os_intf/_timer.h \
475- libnml/os_intf/timer.hh \
476- libnml/posemath/posemath.h \
477- libnml/posemath/gotypes.h \
478409 libnml/posemath/gomath.h \
410+ libnml/posemath/gotypes.h \
411+ libnml/posemath/posemath.h \
479412 libnml/posemath/sincos.h \
480- libnml/rcs/rcs.hh \
481- libnml/rcs/rcs_exit.hh \
482- libnml/rcs/rcs_print.hh \
483- libnml/rcs/rcsversion.h \
484413 rtapi/rtapi.h \
485414 rtapi/rtapi_app.h \
486415 rtapi/rtapi_atomic.h \
487416 rtapi/rtapi_bitops.h \
488417 rtapi/rtapi_bool.h \
489418 rtapi/rtapi_byteorder.h \
419+ rtapi/rtapi_ctype.h \
490420 rtapi/rtapi_device.h \
421+ rtapi/rtapi_errno.h \
491422 rtapi/rtapi_firmware.h \
492423 rtapi/rtapi_gfp.h \
493424 rtapi/rtapi_io.h \
@@ -501,8 +432,6 @@ SRCHEADERS := \
501432 rtapi/rtapi_pci.h \
502433 rtapi/rtapi_slab.h \
503434 rtapi/rtapi_stdint.h \
504- rtapi/rtapi_ctype.h \
505- rtapi/rtapi_errno.h \
506435 rtapi/rtapi_string.h \
507436 rtapi/rtapi_vsnprintf.h
508437
@@ -652,10 +581,10 @@ endif
652581# These rules allows a header file from this directory to be installed into
653582# ../include. A pair of rules like these will exist in the Submakefile
654583# of each file that contains headers.
655- $(patsubst % ,../include/% ,$(wildcard * .h) ) : ../include/% .h: % .h
656- $(Q ) -cp $^ $@
657- $(patsubst % ,../include/% ,$(wildcard * .hh) ) : ../include/% .hh: % .hh
658- $(Q ) -cp $^ $@
584+ # $(patsubst %,../include/%,$(wildcard *.h)): ../include/%.h: %.h
585+ # $(Q)-cp $^ $@
586+ # $(patsubst %,../include/%,$(wildcard *.hh)): ../include/%.hh: %.hh
587+ # $(Q)-cp $^ $@
659588
660589INSTALL =install -o root
661590DIR =$(INSTALL ) -d -m 0755
@@ -924,11 +853,8 @@ endif
924853# "kbuild" system. $(BASEPWD) is used here, instead of relative paths, because
925854# that's what kbuild seems to require
926855
927- EXTRA_CFLAGS := $(filter-out -ffast-math,$(RTFLAGS ) ) -D__MODULE__ -I$(BASEPWD ) /../include -I$(BASEPWD ) -I$(BASEPWD ) /libnml/linklist -I$(BASEPWD ) /emc/tp/ruckig/include \
928- -I$(BASEPWD ) /libnml/cms -I$(BASEPWD ) /libnml/rcs -I$(BASEPWD ) /libnml/inifile \
929- -I$(BASEPWD ) /libnml/os_intf -I$(BASEPWD ) /libnml/nml -I$(BASEPWD ) /libnml/buffer \
930- -I$(BASEPWD ) /libnml/posemath -I$(BASEPWD ) /rtapi -I$(BASEPWD ) /hal \
931- -I$(BASEPWD ) /emc/nml_intf -I$(BASEPWD ) /emc/kinematics -I$(BASEPWD ) /emc/tp -I$(BASEPWD ) /emc/motion \
856+ EXTRA_CFLAGS := $(filter-out -ffast-math,$(RTFLAGS ) ) -D__MODULE__ \
857+ -I$(BASEPWD ) /../include \
932858 -DSEQUENTIAL_SUPPORT -DHAL_SUPPORT -DDYNAMIC_PLCSIZE -DRT_SUPPORT -DOLD_TIMERS_MONOS_SUPPORT -DMODBUS_IO_MASTER \
933859 -fno-fast-math $(call cc-option,-mieee-fp) -fno-unsafe-math-optimizations \
934860 -Wno-declaration-after-statement \
@@ -1351,6 +1277,7 @@ objects/rtemc/tp/ruckig_wrapper.o : emc/tp/ruckig_wrapper.cc
13511277 @rm -f $@
13521278 @mkdir -p $(dir $@ )
13531279 $(Q )$(CXX ) -c $(OPT ) $(DEBUG ) $(EXTRA_DEBUG ) -DRTAPI -std=c++20 \
1280+ -I$(BASEPWD ) /emc/tp/ruckig/include \
13541281 $(RUCKIG_CXXFLAGS ) \
13551282 -MP -MD -MF " ${@: .o=.d} " -MT " $@ " \
13561283 $< -o $@
@@ -1361,6 +1288,7 @@ objects/rtemc/tp/ruckig/src/ruckig/%.o : emc/tp/ruckig/src/ruckig/%.cpp
13611288 @rm -f $@
13621289 @mkdir -p $(dir $@ )
13631290 $(Q )$(CXX ) -c $(OPT ) $(DEBUG ) $(EXTRA_DEBUG ) -DRTAPI -std=c++20 \
1291+ -I$(BASEPWD ) /emc/tp/ruckig/include \
13641292 $(RUCKIG_CXXFLAGS ) \
13651293 -MP -MD -MF " ${@: .o=.d} " -MT " $@ " \
13661294 $< -o $@
0 commit comments