[37] | 1 | # file: Makefile |
---|
| 2 | # author: Andrea Vedaldi |
---|
| 3 | # description: Build SIFT mex files |
---|
| 4 | |
---|
| 5 | DIST=vlutil |
---|
| 6 | VER=1.1.0 |
---|
| 7 | BINDIST=$(DIST)-$(VER)-$(ARCH) |
---|
| 8 | |
---|
| 9 | # -------------------------------------------------------------------- |
---|
| 10 | # |
---|
| 11 | # -------------------------------------------------------------------- |
---|
| 12 | |
---|
| 13 | # Determine on the flight the system we are running on |
---|
| 14 | Darwin_ARCH := mac |
---|
| 15 | Linux_ARCH := glx |
---|
| 16 | ARCH := $($(shell uname)_ARCH) |
---|
| 17 | |
---|
| 18 | #mac_CFLAGS := -O -I. -pedantic -Wall |
---|
| 19 | mac_CFLAGS := -O -I. |
---|
| 20 | mac_MEX_CFLAGS := CFLAGS='$$CFLAGS $(mac_CFLAGS)' |
---|
| 21 | mac_MEX_SUFFIX := mexmac |
---|
| 22 | |
---|
| 23 | # glx_CFLAGS := -O -I. -pedantic -Wall |
---|
| 24 | glx_CFLAGS := -O -I. |
---|
| 25 | glx_MEX_CFLAGS := CFLAGS='$$CFLAGS $(glx_CFLAGS)' |
---|
| 26 | glx_MEX_SUFFIX := mexglx |
---|
| 27 | |
---|
| 28 | MEX_SUFFIX := $($(ARCH)_MEX_SUFFIX) |
---|
| 29 | MEX_CFLAGS := $($(ARCH)_MEX_CFLAGS) |
---|
| 30 | |
---|
| 31 | # -------------------------------------------------------------------- |
---|
| 32 | # |
---|
| 33 | # -------------------------------------------------------------------- |
---|
| 34 | |
---|
| 35 | vpath %.mex.c toolbox |
---|
| 36 | vpath %.mex.cpp toolbox |
---|
| 37 | |
---|
| 38 | src := $(wildcard toolbox/*.mex.c) $(wildcard toolbox/*.mex.cpp) |
---|
| 39 | msrc := $(wildcard toolbox/*.m) |
---|
| 40 | stem := $(notdir $(basename $(basename $(src)))) |
---|
| 41 | tgt := $(addprefix mex/, $(addsuffix .$(MEX_SUFFIX),$(stem))) |
---|
| 42 | |
---|
| 43 | mex/%.$(MEX_SUFFIX) : %.mex.c |
---|
| 44 | mex -I. $(MEX_CFLAGS) $< -outdir 'mex' |
---|
| 45 | @mv mex/$*.mex.$(MEX_SUFFIX) mex/$*.$(MEX_SUFFIX) |
---|
| 46 | |
---|
| 47 | mex/%.$(MEX_SUFFIX) : %.mex.cpp |
---|
| 48 | mex -I. $(MEX_CFLAGS) $< -outdir 'mex' |
---|
| 49 | @mv mex/$*.mex.$(MEX_SUFFIX) mex/$*.$(MEX_SUFFIX) |
---|
| 50 | |
---|
| 51 | .PHONY: all |
---|
| 52 | all: $(tgt) |
---|
| 53 | |
---|
| 54 | .PHONY: info |
---|
| 55 | info : |
---|
| 56 | @echo src = $(src) |
---|
| 57 | @echo stem = $(stem) |
---|
| 58 | @echo tgt = $(tgt) |
---|
| 59 | |
---|
| 60 | # PDF documentation |
---|
| 61 | .PHONY: doc |
---|
| 62 | doc: vlutil.html |
---|
| 63 | |
---|
| 64 | vlutil.html : $(msrc) |
---|
| 65 | mdoc --output=vlutil.html --exclude 'test_*' toolbox |
---|
| 66 | |
---|
| 67 | .PHONY: clean |
---|
| 68 | clean: |
---|
| 69 | rm -f $(tgt) |
---|
| 70 | rm -f .DS_Store .gdb_history |
---|
| 71 | find . -name '*~' -exec rm -f \{\} \; |
---|
| 72 | |
---|
| 73 | .PHONY: distclean |
---|
| 74 | distclean: clean |
---|
| 75 | rm -f mex/*.mexmac mex/*.mexglx |
---|
| 76 | rm -f vlutil.html |
---|
| 77 | rm -rf $(DIST)-* |
---|
| 78 | |
---|
| 79 | .PHONY: dist |
---|
| 80 | dist: distclean |
---|
| 81 | echo Version $(VER) >TIMESTAMP |
---|
| 82 | echo Archive created on `date` >>TIMESTAMP |
---|
| 83 | tar chzvf $(DIST)-$(VER).tar.gz ../$(notdir $(CURDIR)) |
---|
| 84 | |
---|
| 85 | .PHONY: bindist |
---|
| 86 | bindist: all doc |
---|
| 87 | test -e $(BINDIST) || mkdir $(BINDIST) |
---|
| 88 | cp README toolbox/*.m vlutil.html mex/*.$(MEX_SUFFIX) $(BINDIST) |
---|
| 89 | cd $(BINDIST) ; strip -S *.$(MEX_SUFFIX) $(notdir $(LIB)) |
---|
| 90 | echo Version $(VER) >$(BINDIST)/TIMESTAMP |
---|
| 91 | echo Package created on `date` >>$(BINDIST)/TIMESTAMP |
---|
| 92 | tar cvzf $(BINDIST).tar.gz $(BINDIST) |
---|
| 93 | |
---|
| 94 | .PHONY: autorights |
---|
| 95 | autorights: distclean |
---|
| 96 | autorights \ |
---|
| 97 | . \ |
---|
| 98 | --recursive \ |
---|
| 99 | --template gpl \ |
---|
| 100 | --years 2006 \ |
---|
| 101 | --authors "Andrea Vedaldi" \ |
---|
| 102 | --holders "Andrea Vedaldi" \ |
---|
| 103 | --program "VLUtil" |
---|