SiteMap Search ElispArea HowTo Glossary RecentChanges News Problems Suggestions
Cameroon, National Day

UsingMakefileFromParentDirectory

If you often edit source code residing in subdirectories relative to your Makefile, you can use this to directly (re)build:

(defun get-above-makefile () (expand-file-name
	   "Makefile" (loop as d = default-directory then (expand-file-name
	   ".." d) if (file-exists-p (expand-file-name "Makefile" d)) return
	   d)))

;; bind compiling with get-above-makefile to f5
(global-set-key [f5] (lambda () (interactive) (compile (format
	   "make -f %s" (get-above-makefile)))))

coded by bpalmer


CategoryProgramming