#!/bin/sh

# [Gedit Tool]
# Name=Build
# Name[af]=Bou
# Name[ar]=ابنِ
# Name[as]=বিল্ড
# Name[ast]=Construcción
# Name[be]=Пабудова
# Name[be@latin]=Buduj
# Name[bg]=Компилиране
# Name[bn]=বিল্ড
# Name[bn_IN]=বিল্ড
# Name[ca]=Munta
# Name[ca@valencia]=Munta
# Name[crh]=İnşa
# Name[cs]=Sestavit
# Name[cy]=Adeiladu
# Name[da]=Byg
# Name[de]=Alles kompilieren
# Name[dz]=བཟོ་བརྩིགས་
# Name[el]=Χτίσιμο
# Name[en@shaw]=𐑚𐑦𐑤𐑛
# Name[en_GB]=Build
# Name[eo]=Kunmeti
# Name[es]=Construir
# Name[et]=Ehitamine
# Name[eu]=Eraiki
# Name[fa]=ساختن
# Name[fi]=Käännös
# Name[fr]=Construire
# Name[ga]=Tóg
# Name[gl]=Construír
# Name[gu]=Build
# Name[he]=בנייה
# Name[hi]=बिल्ड
# Name[hu]=Összeállítás
# Name[id]=Bangun
# Name[it]=Crea
# Name[ja]=ビルド
# Name[kn]=ನಿರ್ಮಾಣ
# Name[ko]=컴파일하기
# Name[lt]=Sukurti
# Name[lv]=Būvējums
# Name[mai]=निर्मित
# Name[mk]=Изгради
# Name[ml]=ബിള്‍ഡ്
# Name[mr]=बील्ड
# Name[my]=တည်ဆောက်
# Name[nb]=Bygg
# Name[ne]=निर्माण गर्नुहोस्
# Name[nl]=Bouwen
# Name[nn]=Bygg
# Name[oc]=Version
# Name[or]=ନିର୍ମାଣ କରନ୍ତୁ
# Name[pa]=Build
# Name[pl]=Zbudowanie
# Name[ps]=جوړول
# Name[pt]=Compilação
# Name[pt_BR]=Compilar
# Name[ro]=Generează
# Name[ru]=Сборка
# Name[si]=සාදන්න
# Name[sk]=Zostavenie
# Name[sl]=Izgradi
# Name[sq]=Gjenero
# Name[sr]=Изгради
# Name[sr@latin]=Izgradi
# Name[sv]=Bygg
# Name[ta]=உருவாக்கு
# Name[te]=బుల్ట్
# Name[th]=ประกอบสร้าง
# Name[tr]=Derle
# Name[ug]=قۇرۇش
# Name[uk]=Збірка
# Name[vi]=Xây dựng
# Name[zh_CN]=构建
# Name[zh_HK]=建立
# Name[zh_TW]=建立
# Comment=Run "make" in the document directory
# Comment[af]=Voer "make" uit in die dokumentgids
# Comment[ar]=شغّل "make" في دليل المستند
# Comment[as]=আলেখ্যন ধাৰণকাৰী পঞ্জিকাত "make" আদেশ সঞ্চালন কৰক
# Comment[ast]=Executar «make» nel direutoriu del documentu
# Comment[be]=Запуск "make" у каталозе дакумента
# Comment[be@latin]=Uruchom "make" u katalohu dakumentu
# Comment[bg]=Стартиране на „make“ в папката на документа
# Comment[bn]=নথি ধারণকারী ডিরেক্টরির মধ্যে "make" কমান্ড সঞ্চালন করুন
# Comment[bn_IN]=ডকুমেন্ট ধারণকারী ডিরেক্টরির মধ্যে "make" কমান্ড সঞ্চালন করুন
# Comment[ca]=Executa «make» al directori del document
# Comment[ca@valencia]=Executa «make» al directori del document
# Comment[crh]=Vesiqa cilbentinde "make" çaptır
# Comment[cs]=Spustit „make” ve složce dokumentu
# Comment[cy]=Rhedeg "make" yng nghyfeiriadur y ddogfen
# Comment[da]=Start "make" i dokumentmappen
# Comment[de]=»make« im Dokumentenordner ausführen
# Comment[dz]=ཡིག་ཆའི་སྣོད་ཐོ་ནང་ "make" གཡོག་བཀོལ།
# Comment[el]=Εκτέλεση "make" στον κατάλογο εγγράφου
# Comment[en@shaw]=𐑮𐑳𐑯 "𐑥𐑱𐑒" 𐑦𐑯 𐑞 𐑛𐑪𐑒𐑿𐑥𐑩𐑯𐑑 𐑛𐑲𐑮𐑧𐑒𐑑𐑼𐑦
# Comment[en_GB]=Run "make" in the document directory
# Comment[eo]=Lanĉi "make"-on en la dokumenta dosierujo
# Comment[es]=Ejecutar «make» en la carpeta del documento
# Comment[et]="make" käivitamine dokumendikataloogis
# Comment[eu]=Exekutatu "make" dokumentuen direktorioan
# Comment[fa]=اجرا «make» در شاخه سند
# Comment[fi]=Suorita ”make” asiakirjahakemistossa
# Comment[fr]=Exécuter « make » dans le répertoire du document
# Comment[gl]=Executar "make" no cartafol de documentos
# Comment[gu]=દસ્તાવેજ ડિરેક્ટરીમાં "make" ચલાવો
# Comment[he]=הרצת ״make״ בספרייה הנוכחית
# Comment[hi]=दस्तावेज़ निर्देशिका में "make" चलाएँ
# Comment[hu]=A „make” futtatása a dokumentum könyvtárában
# Comment[id]=Jalankan "make" dalam direktori dokumen
# Comment[it]=Esegue «make» nella cartella del documento
# Comment[ja]=ドキュメントのあるフォルダーで "make" を実行します
# Comment[kn]=ದಸ್ತಾವೇಜು ಕೋಶದಲ್ಲಿ "make" ಅನ್ನು ಚಲಾಯಿಸಿ
# Comment[ko]=문서 디렉터리에서 "make"를 실행합니다
# Comment[lt]=Paleisti „make“ dokumento aplanke
# Comment[lv]=Palaist “make” dokumenta direktorijā
# Comment[mai]=दस्ताबेज निर्देशिकामे "make" चलाबू
# Comment[mk]=Изврши „make“ во директориумот на документот
# Comment[ml]=രേഖ ഡയറക്ടറിയില്‍ "make" പ്രവര്‍ത്തിപ്പിക്കുക
# Comment[mr]=दस्तऐवज डिरेक्ट्री मध्ये "make" चालवा
# Comment[nb]=Kjør «make» i dokumentkatalogen
# Comment[ne]=कागजात डाइरेक्टरीमा "make" चलाउनुहोस्
# Comment[nl]=‘make’ uitvoeren in de documentmap
# Comment[nn]=Køyr «make» i dokumentmappa
# Comment[or]=ଦଲିଲ ଡିରେକ୍ଟୋରୀରେ  "make"କୁ ଚଲାନ୍ତୁ
# Comment[pa]=ਡੌਕੂਮੈਂਟ਼ ਡਾਇਰੈਕਟਰੀ 'ਚ "make" ਚਲਾਓ
# Comment[pl]=Wykonuje "make" w katalogu dokumentu
# Comment[pt]=Executar "make" no directório do documento
# Comment[pt_BR]=Executa "make" no diretório do documento
# Comment[ro]=Execută „make” în dosarul documentului
# Comment[ru]=Выполнить «make» в каталоге с документом
# Comment[sk]=Spustiť „make“ v adresári dokumentu
# Comment[sl]=Zaženi "make" v imeniku dokumenta
# Comment[sq]=Ekzekuton "make" në directory e dokumentit
# Comment[sr]=Изврши наредбу „make“ у фасцикли докумената
# Comment[sr@latin]=Izvrši naredbu „make“ u fascikli dokumenata
# Comment[sv]=Kör "make" i dokumentkatalogen
# Comment[ta]=ஆவண அடைவில் “make”ஐ இயக்கு
# Comment[te]=నడుపు పత్రము సంచయంలో "తయారు" చేయి
# Comment[th]=เรียก "make" ในไดเรกทอรีของเอกสาร
# Comment[tr]=Belge dizininde "make" çalıştır
# Comment[ug]=ئارخىپ مۇندەرىجىسىدە «make» نى ئىجرا قىلىڭ
# Comment[uk]=Виконати “make” у каталозі з документом
# Comment[vi]=Chạy lệnh "make" trong thư mục tài liệu
# Comment[zh_CN]=在文档目录中运行“make”
# Comment[zh_HK]=在文件資料夾中執行“make”指令
# Comment[zh_TW]=在文件資料夾中執行“make”指令
# Input=nothing
# Output=output-panel
# Shortcut=<Control>F8
# Applicability=local
# Save-files=nothing
# Languages=

EHOME=`echo $HOME | sed "s/#/\#/"`
DIR=$GEDIT_CURRENT_DOCUMENT_DIR
while test "$DIR" != "/"; do
    for m in GNUmakefile makefile Makefile; do
        if [ -f "${DIR}/${m}" ]; then
            echo "Using ${m} from ${DIR}" | sed "s#$EHOME#~#" > /dev/stderr
            make -C "${DIR}"
            exit
        fi
    done
    DIR=`dirname "${DIR}"`
done
echo "No Makefile found!" > /dev/stderr
