Skip to content

Commit c8cc357

Browse files
committed
feature #54 [FrameworkBundle] improve Makefile serve target (sstok)
This PR was merged into the master branch. Discussion ---------- [FrameworkBundle] improve Makefile serve target Related to #49, I don't know if this the best way to do it. But as the Makefile is composed I don't think it's possible to use advanced Makefile features 😟 @greg0ire suggested something like this: ```makefile .PHONY: serve CONSOLE=bin/console $(CONSOLE): @echo 'Woops! The console does not exist' @EXIT serve: bin/console bin/console list server|grep server:start bin/console server:start ``` But don't know if you can have multiple targets with the same name but different conditions? Commits ------- 7a7de4b [FrameworkBundle] improve Makefile serve target
2 parents 0c15942 + 7a7de4b commit c8cc357

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

symfony/framework-bundle/3.3/Makefile

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,23 @@ 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+
sf_console:
11+
@test -f $(CONSOLE) || printf "Run \033[32mcomposer require cli\033[39m to install the Symfony console.\n"
12+
@exit
13+
14+
serve_as_sf: sf_console
15+
@test -f $(CONSOLE) && $(CONSOLE)|grep server:start > /dev/null || ${MAKE} serve_as_php
16+
@$(CONSOLE) server:start || exit 0
17+
18+
@printf "Quit the server with \033[32;49mbin/console server:stop.\033[39m\n"
19+
20+
serve_as_php:
21+
@printf "\033[32;49mServer listening on http://127.0.0.1:8000\033[39m\n";
22+
@printf "Quit the server with CTRL-C.\n"
23+
@printf "Run \033[32mcomposer require symfony/web-server-bundle\033[39m for a better web server\n"
1324
php -S 127.0.0.1:8000 -t web
14-
.PHONY: serve
25+
26+
serve:
27+
@${MAKE} serve_as_sf
28+
.PHONY: sf_console serve serve_as_sf serve_as_php

0 commit comments

Comments
 (0)