<commit_before># top level Makefile
# -------------
#
# Notes on syntax:
# @ causes each command NOT to be echoed to the console.
# - allows the rule to continue after an error.
#
#
# Notes on targets:
#
# all - default target, makes the whole thing except examples
# examples - makes rtapi examples, run after "make all"
# headers - copies public header files to INC_DIR (emc2/include)
# depend - generate dependency file(s)
# indent - formats source code
# install - installs emc2 files to system directories
#           right now this is commented out (uncomment it if you want to test)
# install_rtscript - this installs the realtime script to /etc/init.d/ and rtapi.conf to /etc
# install_modules - installed the modules to the modulesdir (found by config)
# install_configs - installs the configs to $sysconfdir (usually /usr/local/etc)
# install_bin - installs bins to $bindir (usually /usr/local/bin)
# install_lib - installs libs to $libdir
# install_docs - installs docs to $docdir
# install_ncfiles - installs ncfiles 
# install_tcl - installs tcl code
# install_man - installs man pages
# uninstall - removes emc2 files from system directories
#           - FIXME - not done yet (will need a list of installed files)
# clean - cleans up temp files, backups, object files, binaries, etc.
# tgz - creates emc2.tar.gz containing the sources (does a clean first)
#       Usefull to produce an tarball of the latest CVS
# deb - FIXME - this should produce a deb package using the make install rule
# rpm - FIXME - this should produce a rpm package using the make install rule
#
#
# Makefile.inc contains directory paths and other system dependent stuff
include Makefile.inc

HEADERS = config.h

#
# this rule handles most targets
# it simply changes to all the source sub-directories and calls make there
# note the order - low level code like rtapi is made first, before higher
# level code that might depend on it

all headers indent : def_headers
	chmod +x ../scripts/emc
	chmod +x ../scripts/realtime
	(cd rtapi; make headers)
	(cd libnml; make headers)
	(cd emc; make headers)
	(cd hal; make headers)
	(cd module_helper; make $@)
	(cd rtapi; make $@)
	(cd libnml; make $@)
	(cd hal; make $@)
	(cd emc; make $@)
	@echo 
	@echo '########################################################'
	@echo '# If you intend to run-in-place (without make install) #'
	@echo "# don't forget to run: sudo make setuid                #"
	@echo '########################################################'
	@echo

# Generic rules
include Make.rules

# these variables are used to build a list of all
# man pages that need to be installed

ifneq ($(strip $(MAN_DIR)),)
# MAN_DIR exists, generate list of man pages
MAN1_FILES := $(patsubst docs/man/%,$(MAN_DIR)/%,$(wildcard docs/man/man1/*.1))
MAN3_FILES := $(patsubst docs/man/%,$(MAN_DIR)/%,$(wildcard docs/man/man3/*.3))
MAN_FILES = $(MAN1_FILES) $(MAN3_FILES)
else
# no man dir, do nothing
MAN_FILES =
endif

# this rule installs a single man page

$(MAN_DIR)/% : docs/man/%
	@ echo "install man page $*"
	@ cp $< $@

# this rule handles the install target
# its dependency installs all the man pages

install_rtscript:
	install -d $(DESTDIR)$(initd_dir)
	cp ../scripts/realtime $(DESTDIR)$(initd_dir)/
	#@ echo "realtime script installed"

install_modules:
	install -d $(DESTDIR)$(moduledir)/emc2
	-cp -f ../rtlib/*$(MODULE_EXT) $(DESTDIR)$(moduledir)/emc2
	cp -f ../rtlib/.runinfo $(DESTDIR)$(moduledir)/emc2
	@ echo "kernel modules installed"

install_configs:
	install -d $(DESTDIR)$(sysconfdir)/emc2
	cp ../*.png ../*.gif $(DESTDIR)$(sysconfdir)/emc2
	cp -rf ../configs/* $(DESTDIR)$(sysconfdir)/emc2
	(cd $(DESTDIR)$(sysconfdir)/emc2; find . -type d -name CVS|xargs rm -r)
	@ echo "configs installed"

install_bin:
	install -d $(DESTDIR)$(bindir)
	-cp -f ../bin/* $(DESTDIR)$(bindir)
	cp ../scripts/emc $(DESTDIR)$(bindir)
	chmod +x $(DESTDIR)$(bindir)/emc
	# these will fail unless you're root (or using fakeroot with make deb)
	chown root $(DESTDIR)$(bindir)/emc_module_helper $(DESTDIR)$(bindir)/halcmd
	chmod 4755 $(DESTDIR)$(bindir)/emc_module_helper $(DESTDIR)$(bindir)/halcmd
	@ echo "bin installed"

setuid:
	chown root module_helper/emc_module_helper ../bin/halcmd
	chmod 4750 module_helper/emc_module_helper ../bin/halcmd

install_lib:
	install -d $(DESTDIR)$(libdir)
	(if (test -f ../lib/*.so) ; then cp ../lib/*.so $(DESTDIR)$(libdir); fi)
	-(rm -f ../lib/*.a ../lib/*.o 2>/dev/null)
	@ echo "lib installed"

install_docs:
	install -d $(DESTDIR)$(docsdir)
	-cp -f ../docs/* $(DESTDIR)$(docsdir)
	@ echo "docs installed"

# to be added, when there is a nc_files dir
install_ncfiles:
	install -d $(DESTDIR)$(ncfilesdir)
	-GLOBIGNORE=CVS && cp -f ../nc_files/* $(DESTDIR)$(ncfilesdir)
	@ echo "nc_files installed"

install_tcl:
	install -d $(DESTDIR)$(tcldir)
	install -d $(DESTDIR)$(tcldir)/bin
	install -d $(DESTDIR)$(tcldir)/scripts
	-cp -f ../tcl/* $(DESTDIR)$(tcldir)
	-cp -f ../tcl/bin/* $(DESTDIR)$(tcldir)/bin/
	-cp -f ../tcl/scripts/* $(DESTDIR)$(tcldir)/scripts/
	@ echo "tcl installed"
	
	#install -d /usr/share/locale/$(locale)/LC_MESSAGES
	#@ echo "locale installed"

install_man : $(MAN_FILES)
	(cd rtapi; make $@)
	(cd hal; make $@)

#if you want to test, uncomment the following line (not safe till further testing)
install: install_rtscript install_modules install_configs\
	install_bin install_lib install_docs install_ncfiles\
	install_tcl<commit_msg>install TkEmc the tkemc.tcl conf file to the proper location in /usr/X11R6/lib/X11/app-defaults/<commit_after># top level Makefile
# -------------
#
# Notes on syntax:
# @ causes each command NOT to be echoed to the console.
# - allows the rule to continue after an error.
#
#
# Notes on targets:
#
# all - default target, makes the whole thing except examples
# examples - makes rtapi examples, run after "make all"
# headers - copies public header files to INC_DIR (emc2/include)
# depend - generate dependency file(s)
# indent - formats source code
# install - installs emc2 files to system directories
#           right now this is commented out (uncomment it if you want to test)
# install_rtscript - this installs the realtime script to /etc/init.d/ and rtapi.conf to /etc
# install_modules - installed the modules to the modulesdir (found by config)
# install_configs - installs the configs to $sysconfdir (usually /usr/local/etc)
# install_bin - installs bins to $bindir (usually /usr/local/bin)
# install_lib - installs libs to $libdir
# install_docs - installs docs to $docdir
# install_ncfiles - installs ncfiles 
# install_tcl - installs tcl code
# install_man - installs man pages
# uninstall - removes emc2 files from system directories
#           - FIXME - not done yet (will need a list of installed files)
# clean - cleans up temp files, backups, object files, binaries, etc.
# tgz - creates emc2.tar.gz containing the sources (does a clean first)
#       Usefull to produce an tarball of the latest CVS
# deb - FIXME - this should produce a deb package using the make install rule
# rpm - FIXME - this should produce a rpm package using the make install rule
#
#
# Makefile.inc contains directory paths and other system dependent stuff
include Makefile.inc

HEADERS = config.h

#
# this rule handles most targets
# it simply changes to all the source sub-directories and calls make there
# note the order - low level code like rtapi is made first, before higher
# level code that might depend on it

all headers indent : def_headers
	chmod +x ../scripts/emc
	chmod +x ../scripts/realtime
	(cd rtapi; make headers)
	(cd libnml; make headers)
	(cd emc; make headers)
	(cd hal; make headers)
	(cd module_helper; make $@)
	(cd rtapi; make $@)
	(cd libnml; make $@)
	(cd hal; make $@)
	(cd emc; make $@)
	@echo 
	@echo '########################################################'
	@echo '# If you intend to run-in-place (without make install) #'
	@echo "# don't forget to run: sudo make setuid                #"
	@echo '########################################################'
	@echo

# Generic rules
include Make.rules

# these variables are used to build a list of all
# man pages that need to be installed

ifneq ($(strip $(MAN_DIR)),)
# MAN_DIR exists, generate list of man pages
MAN1_FILES := $(patsubst docs/man/%,$(MAN_DIR)/%,$(wildcard docs/man/man1/*.1))
MAN3_FILES := $(patsubst docs/man/%,$(MAN_DIR)/%,$(wildcard docs/man/man3/*.3))
MAN_FILES = $(MAN1_FILES) $(MAN3_FILES)
else
# no man dir, do nothing
MAN_FILES =
endif

# this rule installs a single man page

$(MAN_DIR)/% : docs/man/%
	@ echo "install man page $*"
	@ cp $< $@

# this rule handles the install target
# its dependency installs all the man pages

install_rtscript:
	install -d $(DESTDIR)$(initd_dir)
	cp ../scripts/realtime $(DESTDIR)$(initd_dir)/
	#@ echo "realtime script installed"

install_modules:
	install -d $(DESTDIR)$(moduledir)/emc2
	-cp -f ../rtlib/*$(MODULE_EXT) $(DESTDIR)$(moduledir)/emc2
	cp -f ../rtlib/.runinfo $(DESTDIR)$(moduledir)/emc2
	@ echo "kernel modules installed"

install_configs:
	install -d $(DESTDIR)$(sysconfdir)/emc2
	cp ../*.png ../*.gif $(DESTDIR)$(sysconfdir)/emc2
	cp -rf ../configs/* $(DESTDIR)$(sysconfdir)/emc2
	(cd $(DESTDIR)$(sysconfdir)/emc2; find . -type d -name CVS|xargs rm -r)
	@ echo "configs installed"

install_bin:
	install -d $(DESTDIR)$(bindir)
	-cp -f ../bin/* $(DESTDIR)$(bindir)
	cp ../scripts/emc $(DESTDIR)$(bindir)
	chmod +x $(DESTDIR)$(bindir)/emc
	# these will fail unless you're root (or using fakeroot with make deb)
	chown root $(DESTDIR)$(bindir)/emc_module_helper $(DESTDIR)$(bindir)/halcmd
	chmod 4755 $(DESTDIR)$(bindir)/emc_module_helper $(DESTDIR)$(bindir)/halcmd
	@ echo "bin installed"

setuid:
	chown root module_helper/emc_module_helper ../bin/halcmd
	chmod 4750 module_helper/emc_module_helper ../bin/halcmd

install_lib:
	install -d $(DESTDIR)$(libdir)
	(if (test -f ../lib/*.so) ; then cp ../lib/*.so $(DESTDIR)$(libdir); fi)
	-(rm -f ../lib/*.a ../lib/*.o 2>/dev/null)
	@ echo "lib installed"

install_docs:
	install -d $(DESTDIR)$(docsdir)
	-cp -f ../docs/* $(DESTDIR)$(docsdir)
	@ echo "docs installed"

# to be added, when there is a nc_files dir
install_ncfiles:
	install -d $(DESTDIR)$(ncfilesdir)
	-GLOBIGNORE=CVS && cp -f ../nc_files/* $(DESTDIR)$(ncfilesdir)
	@ echo "nc_files installed"

install_tcl:
	install -d $(DESTDIR)$(tcldir)
	install -d $(DESTDIR)$(tcldir)/bin
	install -d $(DESTDIR)$(tcldir)/scripts
	install -d $(DESTDIR)/usr/X11R6/lib/X11/app-defaults
	-cp -f ../tcl/TkEmc $(DESTDIR)/usr/X11R6/lib/X11/app-defaults
	-cp -f ../tcl/* $(DESTDIR)$(tcldir)
	-cp -f ../tcl/bin/* $(DESTDIR)$(tcldir)/bin/
	-cp -f ../tcl/scripts/* $(DESTDIR)$(tcldir)/scripts/
	@ echo "tcl installed"
	
	#install -d /usr/share/locale/$(locale)/LC_MESSAGES
	#@ echo "locale installed"

install_man : $(MAN_FILES)
	(cd rtapi; make $@)
	(cd hal; make $@)

#if you want to test, uncomment the following line (not safe till further testing)
install: install_rtscript install_modules install_configs\
	install_bin install_lib install_docs install_ncfiles\
	install_tcl
{'fraction_non_alphanumeric': 0.15442373801338882, 'fraction_numerical': 0.006423014293468428, 'mean_word_length': 3.948522829006267, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6132409', 'n_tokens_mistral': 3942, 'n_tokens_neox': 3791, 'n_words': 1243}