.SECONDARY : # do not remove any intermediate files

.PHONY : shipit

#-------- From: ~/lib/general-rules.make

%.o : %.c       # all .c files are c++ in this project
	$(CXX) $(CXXFLAGS) -c -o $@ $<

% : %.c         # one-step compilation
	$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $<

%.xls : %.gnumeric
	ssconvert $< $@

## dependency-finding scheme (with local mods) based on:
## http://www.gnu.org/manual/make-3.77/html_mono/make.html#SEC42
## (see also include statement at end of this makefile)
%.d: %.c
	@$(SHELL) -ec '$(CXX) -MM $(CXXFLAGS) $< \
		| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
		[ -s $@ ] || rm -f $@'

#--------

c_sources := osc-sim.c

progs := $(c_sources:%.c=%) $(cpp_sources:%.cpp=%)

stuff := $(c_sources) strlib.c strlib.h makefile    \
  harmonic-noise-v.csv harmonic-noise-vhat.csv  \
  noise-resonance.png harmonic-noise.xls

######################################################################

all : $(progs)

osc-sim : osc-sim.o strlib.o
	$(CXX) -o $@ $^ -lfftw


shipit : $(stuff)
	put $^

ALWAYS:
	@echo ...

include $(c_sources:.c=.d)
