2010-11-01 19:58:29 +02:00
|
|
|
#
|
|
|
|
# Makefile - Makefile of cameo
|
|
|
|
#
|
2015-01-16 13:49:07 +02:00
|
|
|
# Written 2010, 2012, 2013, 2015 by Werner Almesberger
|
|
|
|
# Copyright 2010, 2012, 2013, 2015 by Werner Almesberger
|
2010-11-01 19:58:29 +02:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
|
|
|
PREFIX ?= /usr/local
|
|
|
|
|
|
|
|
SHELL=/bin/bash
|
|
|
|
|
|
|
|
MAIN=cameo
|
2012-06-12 20:58:46 +03:00
|
|
|
OBJS=cameo.o excellon.o area-poly2d.o gerber.o gnuplot.o ops.o path.o \
|
2015-01-16 13:49:07 +02:00
|
|
|
connect.o poly2d.o shape.o stl.o lex.yy.o y.tab.o
|
2010-11-01 19:58:29 +02:00
|
|
|
|
2010-11-01 21:56:09 +02:00
|
|
|
CFLAGS_WARN=-Wall -Wshadow -Wmissing-prototypes \
|
|
|
|
-Wmissing-declarations -Wno-format-zero-length
|
2010-12-14 18:41:37 +02:00
|
|
|
SLOPPY = -Wno-unused -Wno-implicit-function-declaration
|
|
|
|
|
|
|
|
# An older version of SLOPPY (seems that bison and flex got tidier):
|
|
|
|
#
|
|
|
|
#SLOPPY = -Wno-unused -Wno-implicit-function-declaration \
|
|
|
|
# -Wno-missing-prototypes -Wno-missing-declarations
|
|
|
|
#
|
|
|
|
|
2012-05-08 06:52:47 +03:00
|
|
|
CFLAGS=$(CFLAGS_WARN) -g -I../poly2d
|
|
|
|
LDFLAGS=-L../poly2d
|
|
|
|
LDLIBS=-lpoly2d -lCGAL -lCGAL_Core -lboost_thread \
|
|
|
|
-lstdc++ -lmpfr -lgmp -lm -lfl
|
2010-12-14 18:41:37 +02:00
|
|
|
YACC = bison -y
|
|
|
|
YYFLAGS = -v
|
2010-11-01 19:58:29 +02:00
|
|
|
|
|
|
|
# ----- Verbosity control -----------------------------------------------------
|
|
|
|
|
|
|
|
CC_normal := $(CC)
|
2010-12-14 18:41:37 +02:00
|
|
|
YACC_normal := $(YACC)
|
|
|
|
LEX_normal := $(LEX)
|
2010-11-01 19:58:29 +02:00
|
|
|
DEPEND_normal := $(CPP) $(CFLAGS) -MM -MG
|
|
|
|
|
|
|
|
CC_quiet = @echo " CC " $@ && $(CC_normal)
|
2010-12-14 18:41:37 +02:00
|
|
|
YACC_quiet = @echo " YACC " $@ && $(YACC_normal)
|
|
|
|
LEX_quiet = @echo " LEX " $@ && $(LEX_normal)
|
2010-11-01 19:58:29 +02:00
|
|
|
DEPEND_quiet = @$(DEPEND_normal)
|
|
|
|
|
|
|
|
ifeq ($(V),1)
|
|
|
|
CC = $(CC_normal)
|
2010-12-14 18:41:37 +02:00
|
|
|
LEX = $(LEX_normal)
|
|
|
|
YACC = $(YACC_normal)
|
2010-11-01 19:58:29 +02:00
|
|
|
DEPEND = $(DEPEND_normal)
|
|
|
|
else
|
|
|
|
CC = $(CC_quiet)
|
2010-12-14 18:41:37 +02:00
|
|
|
LEX = $(LEX_quiet)
|
|
|
|
YACC = $(YACC_quiet)
|
2010-11-01 19:58:29 +02:00
|
|
|
DEPEND = $(DEPEND_quiet)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# ----- Rules -----------------------------------------------------------------
|
|
|
|
|
|
|
|
.PHONY: all clean spotless
|
|
|
|
|
|
|
|
all: $(MAIN)
|
|
|
|
|
|
|
|
$(MAIN): $(OBJS)
|
|
|
|
|
2010-12-14 18:41:37 +02:00
|
|
|
lex.yy.c: lang.l y.tab.h
|
|
|
|
$(LEX) lang.l
|
|
|
|
|
|
|
|
lex.yy.o: lex.yy.c y.tab.h
|
|
|
|
$(CC) -c $(CFLAGS) $(SLOPPY) lex.yy.c
|
|
|
|
|
|
|
|
y.tab.c y.tab.h: lang.y
|
|
|
|
$(YACC) $(YYFLAGS) -d lang.y
|
|
|
|
|
|
|
|
y.tab.o: y.tab.c y.tab.h
|
|
|
|
$(CC) -c $(CFLAGS) $(SLOPPY) y.tab.c
|
|
|
|
|
2010-11-01 19:58:29 +02:00
|
|
|
clean:
|
|
|
|
rm -f $(OBJS) $(OBJS:.o=.d)
|
2010-12-14 18:41:37 +02:00
|
|
|
rm -f lex.yy.c y.output y.tab.c y.tab.h
|
2010-11-01 19:58:29 +02:00
|
|
|
|
|
|
|
spotless: clean
|
|
|
|
rm -f $(MAIN)
|
|
|
|
|
|
|
|
# ----- Install / uninstall ---------------------------------------------------
|
|
|
|
|
|
|
|
install: all
|
|
|
|
mkdir -p $(DESTDIR)/$(PREFIX)/bin/
|
|
|
|
install -m 755 $(MAIN) $(DESTDIR)/$(PREFIX)/bin/
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
rm -f $(DESTDIR)/$(PREFIX)/bin/$(MAIN)
|
|
|
|
|
|
|
|
# ----- Dependencies ----------------------------------------------------------
|
|
|
|
|
|
|
|
# compile and generate dependencies, from fped, based on
|
|
|
|
# http://scottmcpeak.com/autodepend/autodepend.html
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) -c $(CFLAGS) $*.c -o $*.o
|
|
|
|
$(DEPEND) $*.c | \
|
|
|
|
sed -e \
|
|
|
|
'/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/ */:\n/g;H;}' \
|
|
|
|
-e '$${g;p;}' -e d >$*.d; \
|
|
|
|
[ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $*.d; exit 1; }
|
|
|
|
|
|
|
|
-include $(OBJS:.o=.d)
|
|
|
|
|