Root/
| 1 | # |
| 2 | # Makefile - Makefile of cameo |
| 3 | # |
| 4 | # Written 2010, 2012, 2013, 2015 by Werner Almesberger |
| 5 | # Copyright 2010, 2012, 2013, 2015 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 | PREFIX ?= /usr/local |
| 14 | |
| 15 | SHELL=/bin/bash |
| 16 | |
| 17 | MAIN=cameo |
| 18 | OBJS=cameo.o excellon.o area-poly2d.o gerber.o gnuplot.o ops.o path.o \ |
| 19 | connect.o poly2d.o shape.o stl.o lex.yy.o y.tab.o |
| 20 | |
| 21 | CFLAGS_WARN=-Wall -Wshadow -Wmissing-prototypes \ |
| 22 | -Wmissing-declarations -Wno-format-zero-length |
| 23 | SLOPPY = -Wno-unused -Wno-implicit-function-declaration |
| 24 | |
| 25 | # An older version of SLOPPY (seems that bison and flex got tidier): |
| 26 | # |
| 27 | #SLOPPY = -Wno-unused -Wno-implicit-function-declaration \ |
| 28 | # -Wno-missing-prototypes -Wno-missing-declarations |
| 29 | # |
| 30 | |
| 31 | CFLAGS=$(CFLAGS_WARN) -g -I../poly2d |
| 32 | LDFLAGS=-L../poly2d |
| 33 | LDLIBS=-lpoly2d -lCGAL -lCGAL_Core -lboost_thread \ |
| 34 | -lstdc++ -lmpfr -lgmp -lm -lfl |
| 35 | YACC = bison -y |
| 36 | YYFLAGS = -v |
| 37 | |
| 38 | # ----- Verbosity control ----------------------------------------------------- |
| 39 | |
| 40 | CC_normal := $(CC) |
| 41 | YACC_normal := $(YACC) |
| 42 | LEX_normal := $(LEX) |
| 43 | DEPEND_normal := $(CPP) $(CFLAGS) -MM -MG |
| 44 | |
| 45 | CC_quiet = @echo " CC " $@ && $(CC_normal) |
| 46 | YACC_quiet = @echo " YACC " $@ && $(YACC_normal) |
| 47 | LEX_quiet = @echo " LEX " $@ && $(LEX_normal) |
| 48 | DEPEND_quiet = @$(DEPEND_normal) |
| 49 | |
| 50 | ifeq ($(V),1) |
| 51 | CC = $(CC_normal) |
| 52 | LEX = $(LEX_normal) |
| 53 | YACC = $(YACC_normal) |
| 54 | DEPEND = $(DEPEND_normal) |
| 55 | else |
| 56 | CC = $(CC_quiet) |
| 57 | LEX = $(LEX_quiet) |
| 58 | YACC = $(YACC_quiet) |
| 59 | DEPEND = $(DEPEND_quiet) |
| 60 | endif |
| 61 | |
| 62 | # ----- Rules ----------------------------------------------------------------- |
| 63 | |
| 64 | .PHONY: all clean spotless |
| 65 | |
| 66 | all: $(MAIN) |
| 67 | |
| 68 | $(MAIN): $(OBJS) |
| 69 | |
| 70 | lex.yy.c: lang.l y.tab.h |
| 71 | $(LEX) lang.l |
| 72 | |
| 73 | lex.yy.o: lex.yy.c y.tab.h |
| 74 | $(CC) -c $(CFLAGS) $(SLOPPY) lex.yy.c |
| 75 | |
| 76 | y.tab.c y.tab.h: lang.y |
| 77 | $(YACC) $(YYFLAGS) -d lang.y |
| 78 | |
| 79 | y.tab.o: y.tab.c y.tab.h |
| 80 | $(CC) -c $(CFLAGS) $(SLOPPY) y.tab.c |
| 81 | |
| 82 | clean: |
| 83 | rm -f $(OBJS) $(OBJS:.o=.d) |
| 84 | rm -f lex.yy.c y.output y.tab.c y.tab.h |
| 85 | |
| 86 | spotless: clean |
| 87 | rm -f $(MAIN) |
| 88 | |
| 89 | # ----- Install / uninstall --------------------------------------------------- |
| 90 | |
| 91 | install: all |
| 92 | mkdir -p $(DESTDIR)/$(PREFIX)/bin/ |
| 93 | install -m 755 $(MAIN) $(DESTDIR)/$(PREFIX)/bin/ |
| 94 | |
| 95 | uninstall: |
| 96 | rm -f $(DESTDIR)/$(PREFIX)/bin/$(MAIN) |
| 97 | |
| 98 | # ----- Dependencies ---------------------------------------------------------- |
| 99 | |
| 100 | # compile and generate dependencies, from fped, based on |
| 101 | # http://scottmcpeak.com/autodepend/autodepend.html |
| 102 | |
| 103 | %.o: %.c |
| 104 | $(CC) -c $(CFLAGS) $*.c -o $*.o |
| 105 | $(DEPEND) $*.c | \ |
| 106 | sed -e \ |
| 107 | '/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/ */:\n/g;H;}' \ |
| 108 | -e '$${g;p;}' -e d >$*.d; \ |
| 109 | [ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $*.d; exit 1; } |
| 110 | |
| 111 | -include $(OBJS:.o=.d) |
| 112 | |
| 113 |
Branches:
master
