makefile - Better rules for gnu make with docker -
suppose source files located in
~/dev/root
inside ~/dev/root
number of projects.
e.g.
~/dev/root/libraries/libx ~/dev/root/apps/app/appy ~/dev/root/docker/appy
the build tool use called tundra2 , invoked root level.
so if run tundra2 production appy it'll produce it's output to
~/dev/root/t2-output/linux64-gcc-production-default
the binary directly below directory. there intermediate files located within sub-directories in directory.
now annoying bit. whatever reason, docker build uses daemon process copies directory it's being run temporary directory. produces it's image there. haven't yet spent time try , extend tundra2 cope docker i've been using makefile.
so inside docker/appy directory have dockerfile. alongside have makefile. idea cd directory , run make. if builds, should copy outputs t2-output docker/appy directory , run docker build.
so far, i've specified build targets like:
t2out=../../t2-output/linux64-gcc-production-default tag = "appy" all: $(t2out)/appy $(t2out)/appy: cd $(t2out) && tundra2 production appy cp $< . docker build -t $(tag) .
etc
the above cumbersome. tried experimenting below vpath doesn't work. make --debug=v
confirms it. can suggest alternative? (i might consider build tool provided isn't npm based)
vpath=../../t2-output/linux64-gcc-production-default %.so: ...
sometimes run tundra2 build directly ~/dev/root
so i'm trying make detect appy , copied appy different.
i.e. if ~/dev/root/t2-output/linux64-gcc-production-default/appy
different to: ~/dev/root/cluster/docker/appy/appy
then copy ~/dev/root/t2-output/linux64-gcc-production-default/appy
~/dev/root/cluster/docker/appy/appy
and if ~/dev/root/t2-output/linux64-gcc-production-default/appy
doesn't exist, if ~/dev/root/cluster/docker/appy/appy
exist, should go ../../.. run tundra2 , copy output above docker/appy directory can run docker build
after lot of experimentation found works well. it's quite generic. need make sure, buildroot right location of makefile , services correct. can set buildroot in environment.
buildroot=../../.. t2out=$(buildroot)/t2-output/linux64-gcc-production-default tundra2=cd $(buildroot); tundra2 production docker_tag=remoteregistry.example.com/path/appy services=appy all: $(services) docker build -t $(docker_tag) . # libraries build target different had specify # build dependancy $(t2out)/lib.so: $(tundra2) target $(t2out)/%: $(tundra2) $* %: $(t2out)/% cp $< $@ clean: $(services) rm -f $(services) .phony: clean
Comments
Post a Comment