Skip to content

Commit 50107f4

Browse files
committed
[FrameworkBundle] improve Makefile serve target
1 parent 549c14c commit 50107f4

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

symfony/framework-bundle/3.3/Makefile

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,24 @@ cache-warmup: cache-clear
66
@test -f bin/console && bin/console cache:warmup || echo "cannot warmup the cache (needs symfony/console)"
77
.PHONY: cache-warmup
88

9-
serve:
10-
@echo -e "\033[32;49mServer listening on http://127.0.0.1:8000\033[39m"
11-
@echo "Quit the server with CTRL-C."
12-
@echo -e "Run \033[32mcomposer require symfony/web-server-bundle\033[39m for a better web server"
9+
CONSOLE=bin/console
10+
$(CONSOLE):
11+
@printf "\033[31;49m%s could not be found.\033[39m Run \033[32mcomposer require console\033[39m to install the console.\n" "$(CONSOLE)"
12+
@printf "You may use an alternate binary by using: make CONSOLE=path/to/console some_target\n\n"
13+
@exit
14+
15+
serve_as_sf: $(CONSOLE)
16+
@$(CONSOLE)|grep server:start > /dev/null || ${MAKE} serve_as_php
17+
@$(CONSOLE) server:start || exit 0
18+
19+
@printf "Quit the server with \033[32;49mbin/console server:stop.\033[39m\n"
20+
21+
serve_as_php:
22+
@printf "\033[32;49mServer listening on http://127.0.0.1:8000\033[39m\n";
23+
@printf "Quit the server with CTRL-C.\n"
24+
@printf "Run \033[32mcomposer require symfony/web-server-bundle\033[39m for a better web server\n"
1325
php -S 127.0.0.1:8000 -t web
14-
.PHONY: serve
26+
27+
serve:
28+
@${MAKE} serve_as_sf
29+
.PHONY: serve serve_as_sf serve_as_php

0 commit comments

Comments
 (0)