################################################################################
#	Master Makefile for tms-mcsys source
#	T.Barnaby,	BEAM Ltd,	2024-08-16
################################################################################
#
# This currently only creates the rootfs image for the TMS module controllers from an old RPM.
# It was originally used to build this system and could be modified to do this now although
# the source would need to be updated for the latest compiler tools etc.
# Note that some of Cern's TMS systems have only i686 capable CPU's so needs to be built for the i686.
#
#
# Normal build is (as root):
#	make rpms
#
TOP		= ${shell pwd}
srcDir		= ${shell pwd}
include Config.mk
 
all::
build:	rootfsAll kernelAll admxrcAll
image-from-rpm:
	# Create tar image of original RPM
	mkdir -p image-tmp
	(cd image-tmp; rpm2cpio /dist/tms/i686/packages/tms-mcsys-2.1.0-2.beam.i686.rpm | cpio -idm)
	tar -C image-tmp -czf images/tms-mcsys-2.1.0-2.beam.tar.gz .
	rm -fr image-tmp
init:
	mkdir -p rootfs-build rootfs kernel
config: 	init rootfsConfig kernelConfig admxrcConfig
install:	rootfsInstall kernelInstall kernelModulesInstall admxrcInstall nfsBootInstall
clean:	admxrcClean
	rm -fr rootfs-build rootfs var kernel
	rm -f networkBoot/initrd.img
# Debug bits
sysBootInstall:
	cp -a var/lib/tftpboot/tms-mcsys /var/lib/tftpboot
sysRootInstall:
	cp -a rootfs /usr/tms
include System.mk