NoiseByNorthwest/term-asteroids

/bin/bash: -c: line 1: syntax error: unexpected end of file

Opened this issue · 3 comments

❯ make run --debug
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
Reading makefiles...
Updating goal targets....
 File `run' does not exist.
   File `init' does not exist.
  Must remake target `init'.
if [[ ! $(docker images | grep term-asteroids) ]]
/bin/bash: -c: line 1: syntax error: unexpected end of file
make: *** [init] Error 2

You need a recent version of make.

You may find some help in this thread https://stackoverflow.com/questions/43175529/updating-make-version-on-mac

tuqqu commented

you may try this syntax with the old version of make:

.PHONY: init
init:
	if [[ ! $$(docker images | grep $(DOCKER_IMAGE_NAME)) ]]; then \
		$(MAKE) build; \
	fi
	if [[ ! $$(docker ps | grep $(DOCKER_CONTAINER_NAME)) ]]; then \
		if [[ $$(docker ps -a | grep $(DOCKER_CONTAINER_NAME)) ]]; then \
			docker rm $(DOCKER_CONTAINER_NAME); \
		fi; \
		docker run -d \
			-e DISPLAY=${DISPLAY} \
			-v /tmp/.X11-unix:/tmp/.X11-unix \
			-v $$(pwd):/var/www/html \
			-p 8000:8000 \
			--name $(DOCKER_CONTAINER_NAME) $(DOCKER_IMAGE_NAME) \
			bash -c "sleep 3650d"; \
	fi
	if [[ ! -d vendor ]]; then \
		docker exec -it \
			$(DOCKER_CONTAINER_NAME) \
			bash -c 'cd /var/www/html && ./install-composer.sh'; \
	fi

This is a common issue on mac when working with make, and the best fix is to install a recent version of make, especially since the default one is from 2006 or 2004.