# drawing (DXF) to gcode (NGC) converter # Copyright 2013 Stefan Schuermans # Copyleft: CC-BY-SA http://creativecommons.org/licenses/by-sa/3.0/ TARGET=dxfngc SRCS=$(wildcard src/*.cpp) CFLAGS=-Wall -Wextra -Werror -O3 DEFINES= INCLUDES= LDFLAGS= LIBS=-lm -ldime CPP=g++ CPPARGS=$(CFLAGS) $(DEFINES) $(INCLUDES) SRCS_BASE=$(patsubst src/%.cpp,%,$(SRCS)) DEPS=$(addprefix dep/,$(addsuffix .d,$(SRCS_BASE))) OBJS=$(addprefix obj/,$(addsuffix .o,$(SRCS_BASE))) .PHONY: all clean .SECONDARY: .SUFFIXES: all: dep/deps $(TARGET) ifneq ($(MAKECMDGOALS),clean) include dep/deps endif dep: mkdir -p $@ dep/deps: $(DEPS) | dep cat /dev/null $^ >$@ dep/%.d: src/%.cpp Makefile | dep $(CPP) $(CPPARGS) -M -MT$(patsubst src/%.cpp,obj/%.o,$<) -o $@ $< obj: mkdir -p $@ obj/%.o: src/%.cpp Makefile | obj $(CPP) $(CPPARGS) -c -o $@ $< $(TARGET): $(OBJS) $(CPP) $(LDFLAGS) -o $@ $^ $(LIBS) clean: rm -rf dep obj $(TARGET)