aboutsummaryrefslogtreecommitdiff
path: root/toxy/Makefile
blob: 1c06f5b6789d682b3d6f6326c21745f27e34ad8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
ROOT_DIR = ..
WIDPATH = $(ROOT_DIR)/test/toxy/setup.wid
WIQFILE = $(notdir $(WIDPATH:.wid=.wiq))
# this is necessary to deal with cross-platform echo issues with '-e'
ifeq ($(shell echo -e|sed 's|^-||'),e)	
  ECHO = /bin/echo
else
  ECHO = echo
endif
redefault: checkwiq $(WIQFILE) default
checkwiq:
	@if [ -f $(WIQFILE) ] && ! [ -s $(WIQFILE) ] ; then \
		echo ERROR: empty file $(WIQFILE)... removed ; \
		rm -f $(WIQFILE) ; fi
$(WIQFILE): $(WIDPATH)
	@echo transferring widget definitions from \"$<\" to \"$@\"
# LATER think how to replace puts with pdtk_post
	$(ECHO) -e '// Do not edit this file (edit "$<", and run "make").\n//\nputs stderr [concat loading built-in widget definitions]' \
	| cat - $< | sed \
-e '1,\|//$$|{p;d;}' \
-e 's/\([\\\"]\)/\\\1/g' \
-e 's/^.*$$/\"&\\n\"/' > $@
	@if [ -f $(WIQFILE) ] && ! [ -s $(WIQFILE) ] ; then \
		echo ERROR: transfer failed... $(WIQFILE) removed ; \
		rm -f $(WIQFILE) ; fi
include $(ROOT_DIR)/Makefile.common