1# Makefile for the octave sockets package. 2# The intent is to keep this makefile working for 3# * Octave>=3.2 4# * Windows 5# straight out of the box. 6 7OCT := socket.oct 8SRC := $(OCT:.oct=.cc) 9 10MKOCTFILE ?= mkoctfile -Wall 11OCTAVE_CONFIG ?= octave-config 12OCTAVE ?= octave 13 14CANONICAL_HOST_TYPE := $(shell $(OCTAVE_CONFIG) -p CANONICAL_HOST_TYPE)) 15 16#The following is necessary to get the sockets package working in Windows. 17#It has been tried on Win7 and XP, in Octave 3.8.0 using mxe-octave (mingw) 18EXTRALIBS := 19ifneq (,$(findstring mingw,$(CANONICAL_HOST_TYPE))) 20 EXTRALIBS := -lws2_32 21endif 22 23all: $(OCT) 24 25%.oct: %.cc 26 $(MKOCTFILE) $< $(EXTRALIBS) 27 28# We need to generate a PKG_ADD file for this to work. We could also 29# get a string with the stuff in PKG_ADD and eval it before the test 30# command, but it messes up the quotes. 31check: $(OCT) 32 grep PKG_ADD $(SRC) | gsed 's/\/\/ PKG_ADD: //' > PKG_ADD 33 $(OCTAVE) -q --no-window-system --eval "test $(SRC)" 34 rm PKG_ADD 35 36clean: 37 -rm -f *.o octave-core octave-workspace core *.oct *~ PKG_ADD 38 39#This creates a package for distribution. It requires the checked out hg 40#repo to be named sockets, or that a symlink of name sockets point to the 41#checked out repo. 42pkgversion:=$(word 2,$(shell grep ^Version ../DESCRIPTION|head -n1)) 43pkg: 44 cd ../.. && tar cvfzh sockets-${pkgversion}.tar.gz --exclude=.hg sockets/ 45 46.PHONY: all clean check pkg 47