DragonFly BSD
DragonFly users List (threaded) for 2005-05
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

programming: Makefile


From: "George Georgalis" <george@xxxxxxxxx>
Date: Fri, 27 May 2005 15:15:58 -0400

I'm using a Makefile in the top of a checked out cvs repository
to create hardlinks from the checked out tree to the real filesystem.
This helps keep the repository consistent with the live files.

This Makefile target worked fine in each "copy point" but I found I was
duplicating the code in several places, so I changed absolute file paths
to ${REAL} and made it a target in a top level functions.mk which is
included by the Makefile being called


MAKE_REAL_HARD_LINKS :
	# Replicate cvs checked out directory into real location,
	# as directories and hardlinks.
	test -f CVS/Repository # for sanity
	mkdir -p ${REAL}
	test -d ${REAL}
	test -w ${REAL}
	# Create directories as required
	for dir in `find . -mindepth 1 ! \( -path '*/CVS' -prune \) -type d -printf "%P\n"`; do \
		[ -a "${REAL}/$${dir}" -a ! -d "${REAL}/$${dir}" ] || exit 1; \
		mkdir -p ${REAL}/$${dir}; \
	done
	# Make hardlinks for files, but not cvs saved backups or Makefiles
	for file in `find . ! \( -path '*/CVS' -prune \) -type f ! -name .$#\* ! -name Makefile -printf "%P\n"`; do \
		ln -f $${file} ${REAL}/$${file}; \
	done


But now, when I do this (home/geo is a cvs module):

include function.mk
geo :
	make -C home/geo MAKE_REAL_HARD_LINKS REAL=/home/geo

I get...

% make geo       
make -C home/geo MAKE_REAL_HARD_LINKS REAL=/home/geo
make: don't know how to make MAKE_REAL_HARD_LINKS. Stop
*** Error code 2


So how does one "include" targets, or am I going about this wrong?

// George


-- 
George Georgalis, systems architect, administrator Linux BSD IXOYE
http://galis.org/george/ cell:646-331-2027 mailto:george@xxxxxxxxx



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]