Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 1 | # |
| 2 | # Simple make file to generate OpenFlow python files |
| 3 | # |
| 4 | # Fixme: Would like pylibopenflow to be able to run remotely |
| 5 | # Currently, we have to cd to it's dir and refer back to local |
| 6 | |
| 7 | TOP_DIR = ../.. |
| 8 | TOOLS_DIR = .. |
| 9 | DOC_DIR = ${TOP_DIR}/doc |
| 10 | |
| 11 | PYLIBOF_DIR = ${TOOLS_DIR}/pylibopenflow |
| 12 | |
| 13 | TARGET_DIR = ${TOP_DIR}/src/python/oftest/ofmsg |
| 14 | |
| 15 | # Relative to pyopenflow-pythonize exec location |
| 16 | OF_HEADER = include/openflow.h |
| 17 | |
| 18 | # Relative to here |
| 19 | ABS_OF_HEADER = ${PYLIBOF_DIR}/${OF_HEADER} |
| 20 | |
| 21 | PYTHONIZE = bin/pyopenflow-pythonize.py |
| 22 | OFP_GEN_CMD = (cd ${PYLIBOF_DIR} && ${PYTHONIZE} -i ${OF_HEADER} \ |
| 23 | ${TARGET_DIR}/ofp.py) |
Dan Talayco | ac1cb81 | 2010-02-06 20:34:18 -0800 | [diff] [blame] | 24 | OFP_AUX_INFO = ${TARGET_DIR}/ofp_aux.py |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 25 | |
| 26 | # Dependencies for ofp.py |
| 27 | OFP_DEP = ${ABS_OF_HEADER} $(wildcard ${PYLIBOF_DIR}/pylib/*.py) |
Dan Talayco | ac1cb81 | 2010-02-06 20:34:18 -0800 | [diff] [blame] | 28 | OFP_DEP += $(wildcard ${PYLIBOF_DIR}/pylib/of/*.py) |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 29 | |
Dan Talayco | ac1cb81 | 2010-02-06 20:34:18 -0800 | [diff] [blame] | 30 | # Generated and other files |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 31 | GEN_FILES := $(addprefix ${TARGET_DIR}/,ofp.py message.py error.py action.py) |
| 32 | OTHER_FILES := $(addprefix ${TARGET_DIR}/,action_list.py of_message.py) |
| 33 | LINT_SOURCE := ${GEN_FILES} ${OTHER_FILES} |
| 34 | LINT_FILES := $(subst .py,.log,${LINT_SOURCE}) |
| 35 | LINT_FILES := $(subst ${TARGET_DIR}/,lint/,${LINT_FILES}) |
| 36 | |
| 37 | all: ${GEN_FILES} |
| 38 | @echo "Generated files" |
| 39 | |
Dan Talayco | ac1cb81 | 2010-02-06 20:34:18 -0800 | [diff] [blame] | 40 | # The core OpenFlow libraries generated from openflow.h |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 41 | ${TARGET_DIR}/ofp.py: ${OFP_DEP} |
Dan Talayco | ac1cb81 | 2010-02-06 20:34:18 -0800 | [diff] [blame] | 42 | ${OFP_GEN_CMD} > ${OFP_AUX_INFO} |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 43 | |
| 44 | # General rule like src/message.py comes from scripts/message_gen.py |
| 45 | ${TARGET_DIR}/%.py: scripts/%_gen.py ${TARGET_DIR}/ofp.py |
| 46 | python $< > $@ |
| 47 | |
Dan Talayco | ac1cb81 | 2010-02-06 20:34:18 -0800 | [diff] [blame] | 48 | # The pylint files |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 49 | lint/%.log: ${TARGET_DIR}/%.py |
| 50 | (cd ${TARGET_DIR} && pylint -e $(notdir $<)) > $@ |
| 51 | |
| 52 | lint: ${LINT_FILES} |
| 53 | |
| 54 | # For now. just local source doc generated |
| 55 | doc: ${GEN_FILES} ${OTHER_FILES} ${DOC_DIR}/Doxyfile |
| 56 | (cd ${DOC_DIR} && doxygen) |
| 57 | |
| 58 | clean: |
| 59 | rm -rf ${GEN_FILES} ${LINT_FILES} ${DOC_DIR}/html/* |
| 60 | |
| 61 | help: |
| 62 | @echo |
Dan Talayco | 8176c91 | 2010-02-05 22:27:55 -0800 | [diff] [blame] | 63 | @echo "Makefile for oftest source munger" |
| 64 | @echo " Default builds python files and installs in ${TARGET_DIR}" |
| 65 | @echo " make local: Generate files and put in src/" |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 66 | @echo |
Dan Talayco | 8176c91 | 2010-02-05 22:27:55 -0800 | [diff] [blame] | 67 | @echo "Targets:" |
| 68 | @echo " all: Puts generated .py in ${TARGET_DIR}" |
| 69 | @echo " lint: Puts error report in lint/*.log" |
| 70 | @echo " doc: Runs doxygen on generated files in ../../doc" |
| 71 | @echo " clean: Removes generated files" |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 72 | @echo |
Dan Talayco | 8176c91 | 2010-02-05 22:27:55 -0800 | [diff] [blame] | 73 | @echo "Debug info:" |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 74 | @echo |
Dan Talayco | 8176c91 | 2010-02-05 22:27:55 -0800 | [diff] [blame] | 75 | @echo "Files generated GEN_FILES: ${GEN_FILES}" |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 76 | @echo |
Dan Talayco | 8176c91 | 2010-02-05 22:27:55 -0800 | [diff] [blame] | 77 | @echo "Dependencies for ofp.py OFP_DEP: ${OFP_DEP}" |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 78 | @echo |
Dan Talayco | 8176c91 | 2010-02-05 22:27:55 -0800 | [diff] [blame] | 79 | @echo "Already created files OTHER_FILES: ${OTHER_FILES}" |
| 80 | @echo |
| 81 | @echo "LINT_FILES: ${LINT_FILES}" |
Dan Talayco | f75360a | 2010-02-05 22:22:54 -0800 | [diff] [blame] | 82 | |
| 83 | |
| 84 | .PHONY: all local install help doc lint clean |