Root/cameo/Makefile

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
13PREFIX ?= /usr/local
14
15SHELL=/bin/bash
16
17MAIN=cameo
18OBJS=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
21CFLAGS_WARN=-Wall -Wshadow -Wmissing-prototypes \
22            -Wmissing-declarations -Wno-format-zero-length
23SLOPPY = -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
31CFLAGS=$(CFLAGS_WARN) -g -I../poly2d
32LDFLAGS=-L../poly2d
33LDLIBS=-lpoly2d -lCGAL -lCGAL_Core -lboost_thread \
34       -lstdc++ -lmpfr -lgmp -lm -lfl
35YACC = bison -y
36YYFLAGS = -v
37
38# ----- Verbosity control -----------------------------------------------------
39
40CC_normal := $(CC)
41YACC_normal := $(YACC)
42LEX_normal := $(LEX)
43DEPEND_normal := $(CPP) $(CFLAGS) -MM -MG
44
45CC_quiet = @echo " CC " $@ && $(CC_normal)
46YACC_quiet = @echo " YACC " $@ && $(YACC_normal)
47LEX_quiet = @echo " LEX " $@ && $(LEX_normal)
48DEPEND_quiet = @$(DEPEND_normal)
49
50ifeq ($(V),1)
51    CC = $(CC_normal)
52    LEX = $(LEX_normal)
53    YACC = $(YACC_normal)
54    DEPEND = $(DEPEND_normal)
55else
56    CC = $(CC_quiet)
57    LEX = $(LEX_quiet)
58    YACC = $(YACC_quiet)
59    DEPEND = $(DEPEND_quiet)
60endif
61
62# ----- Rules -----------------------------------------------------------------
63
64.PHONY: all clean spotless
65
66all: $(MAIN)
67
68$(MAIN): $(OBJS)
69
70lex.yy.c: lang.l y.tab.h
71        $(LEX) lang.l
72
73lex.yy.o: lex.yy.c y.tab.h
74        $(CC) -c $(CFLAGS) $(SLOPPY) lex.yy.c
75
76y.tab.c y.tab.h: lang.y
77        $(YACC) $(YYFLAGS) -d lang.y
78
79y.tab.o: y.tab.c y.tab.h
80        $(CC) -c $(CFLAGS) $(SLOPPY) y.tab.c
81
82clean:
83        rm -f $(OBJS) $(OBJS:.o=.d)
84        rm -f lex.yy.c y.output y.tab.c y.tab.h
85
86spotless: clean
87        rm -f $(MAIN)
88
89# ----- Install / uninstall ---------------------------------------------------
90
91install: all
92        mkdir -p $(DESTDIR)/$(PREFIX)/bin/
93        install -m 755 $(MAIN) $(DESTDIR)/$(PREFIX)/bin/
94
95uninstall:
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

Archive Download this file

Branches:
master



interactive