Makefile 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. NAME = neo900
  2. #SCHTOC = ../../misc/schtoc/schtoc.pl
  3. .PHONY: pull sync sch sort brd pdf view
  4. .PHONY: test-conn
  5. .PHONY: upload upload-all upload-pdf upload-tar upload-zip clean
  6. #----- Repository helpers -----------------------------------------------------
  7. pull:
  8. git pull
  9. git submodule update --init
  10. $(MAKE) -C kicad-libs/components
  11. -$(MAKE) -C modules
  12. -$(MAKE) -C kicad-libs/modules
  13. sync:
  14. git submodule update
  15. $(MAKE) -C kicad-libs/components
  16. -$(MAKE) -C kicad-libs/modules
  17. #----- Editing and PDF generation ---------------------------------------------
  18. sch:
  19. [ -e kicad-libs ] || ln -s ../../../qi/kicad-libs .
  20. eeschema $(NAME).sch
  21. perl ./sortsheets.pl -q -xy $(NAME).sch || \
  22. { echo "sheet order changed -- run \"make sort\"" 1>&2; \
  23. exit 1; }
  24. sort:
  25. perl ./sortsheets.pl -xy $(NAME).sch >_tmp && \
  26. mv $(NAME).sch $(NAME).bak && mv _tmp $(NAME).sch
  27. brd:
  28. pcbnew $(NAME).kicad_pcb
  29. sed -i '/(diff_pair_/d' $(NAME).kicad_pcb
  30. #
  31. # Warning: "make pdf' generates the PDF from the current files, which means
  32. # that also the date comes from the files, not the repository. If you want
  33. # to change this, use HEAD:neo900.pro instead of neo900.pdf
  34. #
  35. pdf:
  36. TZ=UTC eeplot -n -d "%{%F %T}s" neo900.pro -o neo900.pdf
  37. # $(SCHTOC) -n -z neo900.sch neo900.pdf >neo900-toc.pdf || \
  38. # { rm -f neo900-toc.pdf; exit 1; }
  39. #----- Documentation ----------------------------------------------------------
  40. REVCOUNT ?= 30
  41. SHEETS = $(shell sed 's/^F1 "\([^"]*\)".*/\1/p;d' neo900.sch)
  42. view: docdb.out
  43. EESHOW_VIEWER=eeshow-viewer \
  44. EESHOW_PDF_VIEWER=$${EESHOW_PDF_VIEWER:-xpdf} \
  45. eeshow -N $(REVCOUNT) -d docdb.out neo900.pro
  46. docdb.out: docdb.in $(SHEETS)
  47. ./gendocdb.pl -c -i $^ >$@ || { rm -f $@; exit 1; }
  48. #----- Snapshots --------------------------------------------------------------
  49. DATE = $(shell date -u +"%Y%m%d-%H%MZ")
  50. COMMIT = $(shell git log -1 --format='%h' -s)
  51. PDF_NAME = neo900-$(DATE)-$(COMMIT).pdf
  52. PDF_DIR = pub/werner/tmp/ee/pdf
  53. TAR_NAME = neo900-$(DATE)-$(COMMIT).tar.bz2
  54. TAR_DIR = pub/werner/tmp/ee/tar
  55. TAR_EXTRA = kicad-libs/components/gencon.lib
  56. ZIP_NAME = neo900-$(DATE)-$(COMMIT).zip
  57. ZIP_DIR = pub/werner/tmp/ee/zip
  58. ZIP_EXTRA = $(TAR_EXTRA)
  59. upload: upload-pdf
  60. upload-all: upload-pdf upload-tar upload-zip
  61. upload-pdf:
  62. TZ=UTC eeplot -n -d "%{%F %T}s" HEAD:neo900.pro -o $(PDF_NAME)
  63. neo900 $(PDF_NAME) $(PDF_DIR)
  64. echo "cd $(PDF_DIR) && ln -sf $(PDF_NAME) neo900.pdf" | neo900
  65. rm -f $(PDF_NAME)
  66. upload-tar:
  67. tar cfj $(TAR_NAME) \
  68. --no-recursion --xform 's|^|neo900-$(DATE)-$(COMMIT)/|' \
  69. `git ls-files` \
  70. `git submodule --quiet foreach \
  71. 'git ls-files | sed "s|^|$$path/|"'` $(TAR_EXTRA)
  72. neo900 $(TAR_NAME) $(TAR_DIR)
  73. echo "cd $(TAR_DIR) && ln -sf $(TAR_NAME) neo900.tar.bz2" | \
  74. neo900
  75. rm -f $(TAR_NAME)
  76. upload-zip:
  77. zip $(ZIP_NAME) \
  78. -nw -X \
  79. `git ls-files` \
  80. `git submodule --quiet foreach \
  81. 'git ls-files | sed "s|^|$$path/|"'` $(ZIP_EXTRA)
  82. neo900 $(ZIP_NAME) $(ZIP_DIR)
  83. echo "cd $(ZIP_DIR) && ln -sf $(ZIP_NAME) neo900.zip" | neo900
  84. rm -f $(ZIP_NAME)
  85. #----- Automated tests --------------------------------------------------------
  86. test-conn:
  87. ../scripts/conncmp.pl neo900.net P1502 neo900.net P1501 \
  88. GND=GND3 HB_AUDIO_GND=GND3 %=%_U \
  89. VBUS=NC OTG_DP=NC OTG_DM=NC OTG_ID=NC \
  90. USB_HB_DP=NC USB_HB_DM=NC
  91. ../scripts/conncmp.pl neo900.net P1504 neo900.net P1503 \
  92. GND=GND3 HB_AUDIO_GND=GND3 %=%_U \
  93. VINTANA2=2V7_U \
  94. VIB_P=NC VIB_M=NC
  95. ../scripts/conncmp.pl neo900.net CON1601 neo900.net CON1701 \
  96. HB_AUDIO_GND=GND2 HB_AUDIO_GND=NFC_GND VBUS=VBUS_OTG \
  97. VHB=HB_GPIO_D_VDD
  98. ../scripts/conncmp.pl neo900.net CON1602 neo900.net CON1702 \
  99. HB_AUDIO_GND=GND2
  100. #----- Cleanup ----------------------------------------------------------------
  101. clean:
  102. rm -f _tmp
  103. rm -f dbdoc.out