makefile - make to compare two folders -
i want use makefile compare 2 folders. if 2 folders equal don't anything, if different want create folder. here makefile complaining about:
#bindirexists:=t ifeq "../.build" "../topica" /bin/sh: ifeq: not found make: *** [checkdest] error 127
the makefile following:
projname=topica top=.. srcdir=src builddir=.build src=topica.cpp executable=topica.exe cc=g++ ################################# #macros: define bindirchk #bindirexists:=$(shell if [ -d '$(top)/$(1)/$(2)/' ]; echo "t"; else echo "f"; fi ) ifeq "$(strip $(top)/$(1))" "$(strip $(top)/$(2))" echo "t" else echo "f" endif endef define mkbuilddirs @echo creating build directories $(top)/$(1) , $(top)/$(1)/$(2) $(shell mkdir -p $(top)/$(1) $(top)/$(1)/$(2)) endef ################################# #main targets , pre-reqs all: checkdest #$(cc) $(srcdir)/$(src) -o $(top)/$(builddir)/$(projname)/$(executable) checkdest: $(call bindirchk,$(builddir),$(projname)) echo $(bindirexists) if [ "$(bindirexists)" "f" ]; # echo test found true $(shell mkdir -p $(top)/$(1) $(top)/$(1)/$(2)) fi clean: rm -rf $(top)/$(builddir)/*
make doesn't have native method comparing 2 files equality (and thereby 2 directories). you'll have equality-checking in kind of script make call (maybe you're trying already, it's hard tell). , if that, might put conditional , code making new directory in script well; don't gain putting in makefile. scripting problem, , once have script working, calling makefile trivial.
(i recommend perl, hear python too.)
Comments
Post a Comment