Root/
| Source at commit 49d603aca384177fcc4dad19964a15fafe200460 created 7 years 4 months ago. By Werner Almesberger, eeshow/kicad/pro.c: KiCad profile processing (to find file names) | |
|---|---|
| 1 | # |
| 2 | # Makefile - build eeshow |
| 3 | # |
| 4 | # Written 2016 by Werner Almesberger |
| 5 | # Copyright 2016 by Werner Almesberger |
| 6 | # |
| 7 | # This program is free software; you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by |
| 9 | # the Free Software Foundation; either version 2 of the License, or |
| 10 | # (at your option) any later version. |
| 11 | # |
| 12 | |
| 13 | SHELL = /bin/bash |
| 14 | |
| 15 | NAME = eeshow |
| 16 | OBJS = main.o version.o \ |
| 17 | kicad/sch-parse.o kicad/sch-render.o kicad/lib-parse.o \ |
| 18 | kicad/lib-render.o kicad/dwg.o kicad/delta.o kicad/sexpr.o \ |
| 19 | kicad/pl-parse.o kicad/pl-render.o kicad/ext.o kicad/pro.o \ |
| 20 | gui/gui.o gui/over.o gui/style.o gui/aoi.o gui/fmt-pango.o gui/input.o \ |
| 21 | gui/progress.o gui/glabel.o gui/sheet.o gui/history.o gui/render.o \ |
| 22 | gui/help.o gui/icons.o \ |
| 23 | file/file.o file/git-util.o file/git-file.o file/git-hist.o \ |
| 24 | gfx/style.o gfx/fig.o gfx/record.o gfx/cro.o gfx/diff.o gfx/gfx.o \ |
| 25 | gfx/text.o gfx/misc.o gfx/pdftoc.o \ |
| 26 | misc/diag.o |
| 27 | |
| 28 | ICONS = delta diff |
| 29 | |
| 30 | CFLAGS = -g -Wall -Wextra -Wno-unused-parameter -Wshadow \ |
| 31 | -Wmissing-prototypes -Wmissing-declarations \ |
| 32 | -I. \ |
| 33 | `pkg-config --cflags cairo` \ |
| 34 | `pkg-config --cflags libgit2` \ |
| 35 | `pkg-config --cflags gtk+-3.0` |
| 36 | LDLIBS = -lm \ |
| 37 | `pkg-config --libs cairo` \ |
| 38 | `pkg-config --libs libgit2` \ |
| 39 | `pkg-config --libs gtk+-3.0` |
| 40 | |
| 41 | GIT_VERSION = $(shell git log -1 --format='%h' -s .) |
| 42 | GIT_STATUS = $(shell [ -z "`git status -s -uno`" ] || echo +) |
| 43 | CFLAGS += -DVERSION='"$(GIT_VERSION)$(GIT_STATUS)"' |
| 44 | |
| 45 | ifneq ($(USE_WEBKIT),) |
| 46 | CFLAGS += -DUSE_WEBKIT `pkg-config --cflags webkit2gtk-4.0` |
| 47 | LDLIBS += `pkg-config --libs webkit2gtk-4.0` |
| 48 | HELP_TEXT = help.html |
| 49 | else |
| 50 | HELP_TEXT = help.txt |
| 51 | endif |
| 52 | |
| 53 | include ../common/Makefile.c-common |
| 54 | |
| 55 | .PHONY: test neo900 sch test testref png pngref pdf diff view newref |
| 56 | |
| 57 | all:: $(NAME) |
| 58 | |
| 59 | $(NAME): $(OBJS) |
| 60 | $(MAKE) -B version.o |
| 61 | $(CC) -o $(NAME) $(OBJS) $(LDLIBS) |
| 62 | |
| 63 | #----- Help textx ------------------------------------------------------------- |
| 64 | |
| 65 | help.inc: $(HELP_TEXT) Makefile |
| 66 | $(BUILD) sed 's/"/\\"/g;s/.*/"&\\n"/' $< >$@ || \ |
| 67 | { rm -f $@; exit 1; } |
| 68 | |
| 69 | gui/help.c: help.inc |
| 70 | |
| 71 | clean:: |
| 72 | rm -f help.inc |
| 73 | |
| 74 | #----- Icons ------------------------------------------------------------------ |
| 75 | |
| 76 | icons/%.hex: icons/%.fig Makefile |
| 77 | $(BUILD) fig2dev -L png -S 4 -Z 0.60 $< | \ |
| 78 | convert - -transparent white - | \ |
| 79 | hexdump -v -e '/1 "0x%x, "' >$@; \ |
| 80 | [ "$${PIPESTATUS[*]}" = "0 0 0" ] || { rm -f $@; exit 1; } |
| 81 | |
| 82 | gui/icons.c: $(ICONS:%=icons/%.hex) |
| 83 | |
| 84 | clean:: |
| 85 | rm -f $(ICONS:%=icons/%.hex) |
| 86 | |
| 87 | #----- Test sheet ------------------------------------------------------------- |
| 88 | |
| 89 | sch: |
| 90 | eeschema test.sch |
| 91 | |
| 92 | test: $(NAME) |
| 93 | ./$(NAME) test.lib test.sch -- fig >out.fig |
| 94 | fig2dev -L png -m 2 out.fig _out.png |
| 95 | [ ! -r ref.png ] || \ |
| 96 | compare -metric AE ref.png _out.png _diff.png || \ |
| 97 | qiv -t -R -D _diff.png ref.png _out.png |
| 98 | |
| 99 | testref: $(NAME) |
| 100 | ./$(NAME) test.lib test.sch -- fig | \ |
| 101 | fig2dev -L png -m 2 >ref.png |
| 102 | |
| 103 | png: $(NAME) |
| 104 | ./$(NAME) test.lib test.sch -- png -o _out.png -s 2 |
| 105 | [ ! -r pngref.png ] || \ |
| 106 | compare -metric AE pngref.png _out.png _diff.png || \ |
| 107 | qiv -t -R -D _diff.png pngref.png _out.png |
| 108 | |
| 109 | pngref: $(NAME) |
| 110 | ./$(NAME) test.lib test.sch -- png -o pngref.png -s 2 |
| 111 | |
| 112 | clean:: |
| 113 | rm -f out.fig _out.png _diff.png |
| 114 | |
| 115 | #----- Render Neo900 schematics ----------------------------------------------- |
| 116 | |
| 117 | NEO900_HW = ../../../n9/ee/hw |
| 118 | KICAD_LIBS = ../../kicad-libs/components |
| 119 | |
| 120 | SHEET ?= 12 |
| 121 | |
| 122 | neo900: $(NAME) |
| 123 | ./$(NAME) $(NEO900_HW)/neo900.lib \ |
| 124 | $(KICAD_LIBS)/powered.lib \ |
| 125 | $(NEO900_HW)/neo900_SS_$(SHEET).sch \ |
| 126 | >out.fig |
| 127 | |
| 128 | neo900.pdf: $(NAME) sch2pdf neo900-template.fig |
| 129 | ./sch2pdf -o $@ -t neo900-template.fig \ |
| 130 | $(NEO900_HW)/neo900.lib $(KICAD_LIBS)/powered.lib \ |
| 131 | $(NEO900_HW)/neo900.sch |
| 132 | |
| 133 | pdf: $(NAME) |
| 134 | ./eeshow -r $(NEO900_HW)/neo900pageframe_A3.kicad_wks \ |
| 135 | neo900.lib kicad-libs/components/powered.lib \ |
| 136 | $(NEO900_HW)/neo900.sch -- pdf -o neo900.pdf |
| 137 | |
| 138 | #----- Regression test based on Neo900 schematics ----------------------------- |
| 139 | |
| 140 | diff: $(NAME) |
| 141 | test/genpng test out |
| 142 | test/comp test || $(MAKE) view |
| 143 | |
| 144 | view: |
| 145 | qiv -t -R -D `echo test/_diff*.png | \ |
| 146 | sed 's/\([^ ]*\)_diff\([^ ]*\)/\1_diff\2 \1ref\2 \1out\2/g'` |
| 147 | |
| 148 | newref: |
| 149 | test/genpng test ref |
| 150 | |
Branches:
master
