summaryrefslogtreecommitdiff
path: root/hw/Makefile
blob: 346f7ee8c9d078025616d9b3e4015e7f68f91996 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
NAME = neo900
#SCHTOC = ../../misc/schtoc/schtoc.pl

.PHONY:		pull sync sch sort brd pdf view
.PHONY:		test-conn
.PHONY:		upload upload-all upload-pdf upload-tar upload-zip clean

#----- Repository helpers -----------------------------------------------------

pull:
		git pull
		git submodule update --init
		$(MAKE) -C kicad-libs/components
		-$(MAKE) -C modules
		-$(MAKE) -C kicad-libs/modules

sync:
		git submodule update
		$(MAKE) -C kicad-libs/components
		-$(MAKE) -C kicad-libs/modules

#----- Editing and PDF generation ---------------------------------------------

sch:
		[ -e kicad-libs ] || ln -s ../../../qi/kicad-libs .
		eeschema $(NAME).sch
		perl ./sortsheets.pl -q -xy $(NAME).sch || \
		    { echo "sheet order changed -- run \"make sort\"" 1>&2; \
		    exit 1; }

sort:
		perl ./sortsheets.pl -xy $(NAME).sch >_tmp && \
		    mv $(NAME).sch $(NAME).bak && mv _tmp $(NAME).sch

brd:
		pcbnew $(NAME).kicad_pcb
		sed -i '/(diff_pair_/d' $(NAME).kicad_pcb

#
# Warning: "make pdf' generates the PDF from the current files, which means
# that also the date comes from the files, not the repository. If you want
# to change this, use HEAD:neo900.pro instead of neo900.pdf
#

pdf:
		TZ=UTC eeplot -n -d "%{%F %T}s" neo900.pro -o neo900.pdf
#		$(SCHTOC) -n -z neo900.sch neo900.pdf >neo900-toc.pdf || \
#		    { rm -f neo900-toc.pdf; exit 1; }

#----- Documentation ----------------------------------------------------------

REVCOUNT ?= 30
SHEETS = $(shell sed 's/^F1 "\([^"]*\)".*/\1/p;d' neo900.sch)

view:		docdb.out
		EESHOW_VIEWER=eeshow-viewer \
		  EESHOW_PDF_VIEWER=$${EESHOW_PDF_VIEWER:-xpdf} \
		  eeshow -N $(REVCOUNT) -d docdb.out neo900.pro

docdb.out:	docdb.in $(SHEETS)
		./gendocdb.pl -c -i $^ >$@ || { rm -f $@; exit 1; }

#----- Snapshots --------------------------------------------------------------

DATE = $(shell date -u +"%Y%m%d-%H%MZ")
COMMIT = $(shell git log -1 --format='%h' -s)
PDF_NAME = neo900-$(DATE)-$(COMMIT).pdf
PDF_DIR = pub/werner/tmp/ee/pdf
TAR_NAME = neo900-$(DATE)-$(COMMIT).tar.bz2
TAR_DIR = pub/werner/tmp/ee/tar
TAR_EXTRA = kicad-libs/components/gencon.lib
ZIP_NAME = neo900-$(DATE)-$(COMMIT).zip
ZIP_DIR = pub/werner/tmp/ee/zip
ZIP_EXTRA = $(TAR_EXTRA)

upload:		upload-pdf

upload-all:	upload-pdf upload-tar upload-zip

upload-pdf:
		TZ=UTC eeplot -n -d "%{%F %T}s" HEAD:neo900.pro -o $(PDF_NAME)
		neo900 $(PDF_NAME) $(PDF_DIR)
		echo "cd $(PDF_DIR) && ln -sf $(PDF_NAME) neo900.pdf" | neo900
		rm -f $(PDF_NAME)

upload-tar:
		tar cfj $(TAR_NAME) \
		    --no-recursion --xform 's|^|neo900-$(DATE)-$(COMMIT)/|' \
		    `git ls-files` \
		    `git submodule --quiet foreach \
		    'git ls-files | sed "s|^|$$path/|"'` $(TAR_EXTRA)
		neo900 $(TAR_NAME) $(TAR_DIR)
		echo "cd $(TAR_DIR) && ln -sf $(TAR_NAME) neo900.tar.bz2" | \
		    neo900
		rm -f $(TAR_NAME)

upload-zip:
		zip $(ZIP_NAME) \
		    -nw -X \
		    `git ls-files` \
		    `git submodule --quiet foreach \
		    'git ls-files | sed "s|^|$$path/|"'` $(ZIP_EXTRA)
		neo900 $(ZIP_NAME) $(ZIP_DIR)
		echo "cd $(ZIP_DIR) && ln -sf $(ZIP_NAME) neo900.zip" | neo900
		rm -f $(ZIP_NAME)

#----- Automated tests --------------------------------------------------------

test-conn:
		../scripts/conncmp.pl neo900.net P1502 neo900.net P1501 \
		    GND=GND3 HB_AUDIO_GND=GND3 %=%_U \
		    VBUS=NC OTG_DP=NC OTG_DM=NC OTG_ID=NC \
		    USB_HB_DP=NC USB_HB_DM=NC
		../scripts/conncmp.pl neo900.net P1504 neo900.net P1503 \
		    GND=GND3 HB_AUDIO_GND=GND3 %=%_U \
		    VINTANA2=2V7_U \
		    VIB_P=NC VIB_M=NC
		../scripts/conncmp.pl neo900.net CON1601 neo900.net CON1701 \
		    HB_AUDIO_GND=GND2 HB_AUDIO_GND=NFC_GND VBUS=VBUS_OTG \
		    VHB=HB_GPIO_D_VDD
		../scripts/conncmp.pl neo900.net CON1602 neo900.net CON1702 \
		    HB_AUDIO_GND=GND2

#----- Cleanup ----------------------------------------------------------------

clean:
		rm -f _tmp
		rm -f dbdoc.out