# Last edited on 2010-03-13 00:37:27 by stolfi

SUBDIRS := \
  logotipos-latex \
  logotipos \
  papel-timbrado-rodolfo \
  papel-timbrado-stolfi \
  papel-timbrado-windows \
  placas \
  relatorios-tecnicos

.PHONY: all examples cleanlists filelists debug

all:
	@echo "make what?"
        
examples:
	for dir in ${SUBDIRS} ; do \
          ( cd $$dir && ${MAKE} examples ) ; \
        done

debug:
	@echo "ALLDIRS = ${ALLDIRS}"
        
FILELISTS := \
  .files \
  .sourcefiles \
  .makefiles \
  .trashfiles \
  .symlinks

ALLDIRS := \
  . \
  ${wildcard */.} \
  ${wildcard */*/.} \
  ${wildcard */*/*/.}

filelists: cleanlists ${FILELISTS}

cleanlists: 
	rm -f ${FILELISTS}

.files: ${ALLDIRS}
	find ./ -type f -print \
          | sort \
          > .files
        
.sourcefiles: .files
	cat .files \
          | egrep -v -e 'JUNK|junk|OLD|SAVE|[~]$$|[/][.]' \
          | egrep -v -e '[.](pdf|eps|jpg|tif|png|ps|dvi|aux|bbl|blg|log|lof|lot|toc|errs)$$' \
          > .sourcefiles
        
.makefiles: .files
	cat .files \
          | egrep -v -e 'JUNK|junk|OLD|SAVE|[~]$$|[/][.]' \
          | egrep -e '[/]Makefile|[.]make$$' \
          > .makefiles

.trashfiles: .files
	cat .files \
          | egrep -e '[.](ps|aux|bbl|blg|log|lof|lot|toc|errs)$$' \
          > .trashfiles

.symlinks:
	find ./ -type l -ls \
          | gawk '($$12=="->") { print $$11, $$13; next; } // { print "#", $$0; }' \
          | sort \
          > .symlinks
	-egrep -e '^[\#]' .symlinks
	
