chiark / gitweb /
build system: sed in the right lib setting
[chiark-tcl-applet.git] / Makefile
index 05911432b1d51e7c43e465222609425fe11acd79..a067dcbc8e617a8f16cebb299a81fd84ac5110cd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -12,11 +12,21 @@ sharedir=$(prefix)/share/$p
 SCRIPTS += xbatmon-simple-tray
 TCLLIBS += $(addsuffix .tcl, applet args subproc utils)
 
-all:
+SEDDED_SCRIPTS= $(addprefix tmp/, $(SCRIPTS))
 
-install:
+all:   $(SEDDED_SCRIPTS)
+
+tmp:
+       mkdir -p tmp
+
+tmp/%: % tmp
+       sed '1,/^source/ s#^set lib \.#set lib $(sharedir)#' $* >$@
+       chmod +x $@
+
+install: all
        $(INSTALL) -d $(addprefix $(DESTDIR), $(bindir) $(sharedir))
-       $(INSTALL_SCRIPT) $(SCRIPTS) $(DESTDIR)$(bindir)
+       $(INSTALL_SCRIPT) $(SEDDED_SCRIPTS) $(DESTDIR)$(bindir)
        $(INSTALL) $(TCLLIBS) $(DESTDIR)$(sharedir)
 
 clean:
+       rm -rf tmp