| 1 | MANAGE_PY = python manage.py |
| 2 | ROOT_DIR = xnet |
| 3 | APPS = $(shell find $(ROOT_DIR) -name 'models.py' | sed 's,/models.py$$,,; s:.*/::') |
| 4 | |
| 5 | |
| 6 | # In order to help newcomers, this variable holds a full doc of the current Makefile. |
| 7 | # Please keep it up to date with regard to new commands. |
| 8 | # |
| 9 | # Structure: |
| 10 | # - Group commands in sections |
| 11 | # - Align command descriptions |
| 12 | |
| 13 | define help |
| 14 | Makefile command help |
| 15 | |
| 16 | Available targets are: |
| 17 | |
| 18 | Running: |
| 19 | run: Start a development server on http://127.0.0.1:8000/ |
| 20 | shell: Open a development Python shell using the current database |
| 21 | |
| 22 | Database: |
| 23 | resetdb: Reinitialize the database schema |
| 24 | |
| 25 | Testing: |
| 26 | test: Run the test suite |
| 27 | |
| 28 | Misc: |
| 29 | clean: Cleanup all temporary files (*.pyc, ...) |
| 30 | doc: Generate the documentation |
| 31 | help: Display this help message |
| 32 | endef |
| 33 | |
| 34 | default: all |
| 35 | |
| 36 | |
| 37 | all: |
| 38 | |
| 39 | |
| 40 | help: |
| 41 | @echo -n "" # Don't display extra lines. |
| 42 | $(info $(help)) |
| 43 | |
| 44 | |
| 45 | .PHONY: all default help |
| 46 | |
| 47 | |
| 48 | # Running |
| 49 | # ======= |
| 50 | |
| 51 | run: |
| 52 | $(MANAGE_PY) runserver |
| 53 | |
| 54 | shell: |
| 55 | $(MANAGE_PY) shell |
| 56 | |
| 57 | |
| 58 | .PHONY: run shell |
| 59 | |
| 60 | # Development |
| 61 | # =========== |
| 62 | |
| 63 | |
| 64 | test: |
| 65 | $(MANAGE_PY) test $(APPS) |
| 66 | |
| 67 | resetdb: |
| 68 | rm -f xnet/db.sqlite |
| 69 | $(MANAGE_PY) syncdb --noinput |
| 70 | |
| 71 | .PHONY: resetdb test |
| 72 | |
| 73 | # Misc |
| 74 | # ==== |
| 75 | |
| 76 | clean: |
| 77 | find . "(" -name "*.pyc" -or -name "*.pyo" -or -name "*.mo" ")" -delete |
| 78 | find . -type d -empty -delete |
| 79 | |
| 80 | doc: |
| 81 | $(MAKE) -C doc html |
| 82 | |
| 83 | |
| 84 | .PHONY: clean doc |