[PD-cvs] packages/linux_make Makefile, NONE, 1.1 generate_install_makefile.bash, NONE, 1.1

Hans-Christoph Steiner eighthave at users.sourceforge.net
Mon Nov 28 07:46:20 CET 2005


Update of /cvsroot/pure-data/packages/linux_make
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32078/linux_make

Added Files:
	Makefile generate_install_makefile.bash 
Log Message:


- finally got a Linux Pd-extended release out, RC5

- built a tar.bz2 package maker with a generated Makefile for installing and
  uninstalling

- switched all Makefiles to follow GNU $(DESTDIR)/$(prefix) standards



--- NEW FILE: Makefile ---
#
# for making a tar.bz2 that installs using a Makefile
#
all: install

CWD := $(shell pwd)

DESTDIR = $(CWD)/build/
cvs_root_dir = $(CWD)/../..
BUILDLAYOUT_DIR = $(CWD)/..


include $(BUILDLAYOUT_DIR)/Makefile.buildlayout


# these are sent to all of the various Makefiles so that they all copy their
# output to the same directory tree
DEST_PATHS = BUILDLAYOUT_DIR=$(BUILDLAYOUT_DIR) \
				cvs_root_dir=$(cvs_root_dir) \
				DESTDIR=$(DESTDIR) \
				prefix=$(prefix) \
				UNAME=$(UNAME)


install: 
	cd $(packages_src) && make $(DEST_PATHS) install
	cd $(packages_src) && make $(DEST_PATHS) doc_format
	@echo " "
	@echo "linux_make install succeeded!"

#==============================================================================#
#
## 
#
#==============================================================================#

PACKAGE_NAME = Pd-$(PD_VERSION)-$(PACKAGE_VERSION)-$(OS_NAME)-$(shell uname -m)
tarbz2:
# it is very hard to escape the $ in shell scripts so delete files
	-rm -f -- $(helpdir)/iemabs/*\$$*.pd $(objectsdir)/iemabs/*\$$*.pd
	-./generate_install_makefile.bash  $(DESTDIR)$(prefix) > tarbz2Makefile
	mv -i tarbz2Makefile $(DESTDIR)$(prefix)/Makefile
	mv $(DESTDIR)$(prefix) $(DESTDIR)$(PACKAGE_NAME)
	cd $(DESTDIR) && \
		tar cjf $(PACKAGE_NAME).tar.bz2  $(PACKAGE_NAME)
	mv $(DESTDIR)$(PACKAGE_NAME) $(DESTDIR)$(prefix)

#==============================================================================#
#
## CVS SOURCES
#
#==============================================================================#

clean: 	
	cd $(packages_src) && make $(DEST_PATHS) clean



--- NEW FILE: generate_install_makefile.bash ---
#!/bin/bash

ROOT_DIR=`echo $1 | sed 's|/*$||'`
prefix=$2

if [ $# -ne 1 ]; then
	 echo "Usage: $0 ROOT_DIR"
	 exit;
fi

SED=`echo sed "s|${ROOT_DIR}/||"`

function print_file ()
{
	 local my_file=$1
	 echo -e "\tinstall -p '$my_file' '\$(prefix)/$my_file'"
}

function print_dir ()
{
	 echo -e "\tinstall -d -m0755 '\$(prefix)/$1'"
}

function traverse_install_tree ()
{
	 for file in `\ls -1d $1/*`; do
		  local target=`echo $file | $SED`
		  if [ -d "$file" ]; then
				print_dir "$target"
				traverse_install_tree "$file"
		  elif [ -f "$file" ]; then
				print_file "$target"
#		  else
#				echo "MYSTERY FILE: $file"
		  fi
	 done
}

function remove_file () 
{
# arg, $n-help.pd causes lots of problems
#	 local my_file=`echo $1 | sed 's|$|\\$|g'`
	 local my_file=$1
	 echo -e "\trm -f -- '\$(prefix)/$my_file'"
}

function remove_dir ()
{
	 echo -e "\t-rmdir '\$(prefix)/$1'"
}

function uninstall_tree ()
{
	 for file in `\ls -1d $1/*`; do
		  local target=`echo $file | $SED`
		  if [ -d "$file" ]; then
				uninstall_tree "$file"
				remove_dir "$target"
		  elif [ -f "$file" ]; then
				remove_file "$target"
#		  else
#				echo "MYSTERY FILE: $file"
		  fi
	 done
}


echo ""
echo "prefix = /usr/local"
echo ""
echo ""
echo "install:"
traverse_install_tree $ROOT_DIR

echo ""
echo ""
echo ""
echo "uninstall:"
uninstall_tree $ROOT_DIR





More information about the Pd-cvs mailing list