2016-07-22 06:04:42 +03:00
|
|
|
#
|
|
|
|
# Makefile - build sch2fig
|
|
|
|
#
|
|
|
|
# Written 2016 by Werner Almesberger
|
|
|
|
# Copyright 2016 by Werner Almesberger
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
|
2016-07-22 05:54:32 +03:00
|
|
|
NAME = sch2fig
|
2016-07-31 20:36:42 +03:00
|
|
|
OBJS = main.o sch-parse.o sch-render.o lib-parse.o lib-render.o \
|
2016-07-31 21:10:14 +03:00
|
|
|
file.o \
|
2016-08-01 05:07:05 +03:00
|
|
|
style.o fig.o layer.o cairo.o gfx.o dwg.o text.o misc.o
|
2016-07-22 05:54:32 +03:00
|
|
|
|
2016-07-31 06:04:43 +03:00
|
|
|
CFLAGS = -g -O -Wall -Wextra -Wno-unused-parameter -Wshadow \
|
2016-07-31 20:07:29 +03:00
|
|
|
-Wmissing-prototypes -Wmissing-declarations \
|
2016-07-31 06:04:43 +03:00
|
|
|
`pkg-config --cflags cairo`
|
|
|
|
LIBS = -lm `pkg-config --libs cairo`
|
2016-07-22 05:54:32 +03:00
|
|
|
|
2016-07-22 06:04:42 +03:00
|
|
|
include ../common/Makefile.c-common
|
2016-07-22 05:54:32 +03:00
|
|
|
|
2016-08-01 04:40:16 +03:00
|
|
|
.PHONY: test neo900 sch test testref png pngref diff view newref
|
2016-07-22 05:54:32 +03:00
|
|
|
|
|
|
|
all:: $(NAME)
|
|
|
|
|
|
|
|
$(NAME): $(OBJS)
|
2016-07-23 12:58:21 +03:00
|
|
|
$(CC) -o $(NAME) $(OBJS) $(LIBS)
|
2016-07-22 05:54:32 +03:00
|
|
|
|
2016-07-27 02:27:12 +03:00
|
|
|
#----- Test sheet -------------------------------------------------------------
|
2016-07-22 05:54:32 +03:00
|
|
|
|
2016-07-23 20:59:37 +03:00
|
|
|
sch:
|
|
|
|
eeschema test.sch
|
|
|
|
|
2016-07-22 05:54:32 +03:00
|
|
|
test: $(NAME)
|
2016-07-25 17:34:58 +03:00
|
|
|
./$(NAME) test.lib test.sch >out.fig
|
2016-07-27 02:27:12 +03:00
|
|
|
fig2dev -L png -m 2 out.fig _out.png
|
|
|
|
[ ! -r ref.png ] || \
|
2016-07-27 02:40:39 +03:00
|
|
|
compare -metric AE ref.png _out.png _diff.png || \
|
2016-07-27 02:27:12 +03:00
|
|
|
qiv -t -R -D _diff.png ref.png _out.png
|
|
|
|
|
|
|
|
testref:
|
|
|
|
./$(NAME) test.lib test.sch | fig2dev -L png -m 2 >ref.png
|
|
|
|
|
2016-08-01 04:40:16 +03:00
|
|
|
png:
|
2016-08-01 06:11:53 +03:00
|
|
|
./$(NAME) test.lib test.sch -- cairo -o _out.png -s 2
|
2016-08-01 04:40:16 +03:00
|
|
|
[ ! -r pngref.png ] || \
|
2016-08-01 06:11:53 +03:00
|
|
|
compare -metric AE pngref.png _out.png _diff.png || \
|
|
|
|
qiv -t -R -D _diff.png pngref.png _out.png
|
2016-08-01 04:40:16 +03:00
|
|
|
|
|
|
|
pngref:
|
2016-08-01 06:11:53 +03:00
|
|
|
./$(NAME) test.lib test.sch -- cairo -o pngref.png -s 2
|
2016-08-01 04:40:16 +03:00
|
|
|
|
2016-07-27 02:27:12 +03:00
|
|
|
clean::
|
|
|
|
rm -f out.fig _out.png _diff.png
|
|
|
|
|
|
|
|
#----- Render Neo900 schematics -----------------------------------------------
|
|
|
|
|
|
|
|
NEO900_HW = ../../../n9/ee/hw
|
|
|
|
KICAD_LIBS = ../../kicad-libs/components
|
2016-07-25 17:34:58 +03:00
|
|
|
|
|
|
|
SHEET ?= 12
|
|
|
|
|
|
|
|
neo900: $(NAME)
|
2016-07-22 06:16:14 +03:00
|
|
|
./$(NAME) $(NEO900_HW)/neo900.lib \
|
|
|
|
$(KICAD_LIBS)/powered.lib \
|
2016-07-25 17:34:58 +03:00
|
|
|
$(NEO900_HW)/neo900_SS_$(SHEET).sch \
|
2016-07-22 05:54:32 +03:00
|
|
|
>out.fig
|
2016-07-25 23:42:50 +03:00
|
|
|
|
2016-07-26 08:34:56 +03:00
|
|
|
neo900.pdf: $(NAME) sch2pdf neo900-template.fig
|
2016-07-30 04:00:57 +03:00
|
|
|
./sch2pdf -o $@ -t neo900-template.fig \
|
2016-07-25 23:42:50 +03:00
|
|
|
$(NEO900_HW)/neo900.lib $(KICAD_LIBS)/powered.lib \
|
|
|
|
$(NEO900_HW)/neo900.sch
|
2016-07-26 19:12:25 +03:00
|
|
|
|
2016-07-27 02:27:12 +03:00
|
|
|
#----- Regression test based on Neo900 schematics -----------------------------
|
|
|
|
|
2016-07-26 19:59:14 +03:00
|
|
|
diff: $(NAME)
|
2016-07-26 19:12:25 +03:00
|
|
|
test/genpng test out
|
|
|
|
test/comp test || $(MAKE) view
|
|
|
|
|
|
|
|
view:
|
|
|
|
qiv -t -R -D `echo test/_diff*.png | \
|
|
|
|
sed 's/\([^ ]*\)_diff\([^ ]*\)/\1_diff\2 \1ref\2 \1out\2/g'`
|
|
|
|
|
|
|
|
newref:
|
|
|
|
test/genpng test ref
|