Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Octave: use common example.mk for examples, patterned after javascript

  • Loading branch information...
commit b2d492c15a0240d8954d3702a87f90eb34fd49fb 1 parent ebe1338
Karl Wette authored
View
18 Examples/octave/callback/Makefile
@@ -1,17 +1,3 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-CXXSRCS = example.cxx
-TARGET = swigexample
-INTERFACE = example.i
-LIBS = -lm
-SWIGOPT =
+CXXSRCS = example.cxx
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean
+include $(SRCDIR)../example.mk
View
18 Examples/octave/class/Makefile
@@ -1,17 +1,3 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-CXXSRCS = example.cxx
-TARGET = swigexample
-INTERFACE = example.i
-LIBS = -lm
-SWIGOPT =
+CXXSRCS = example.cxx
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean
+include $(SRCDIR)../example.mk
View
18 Examples/octave/constants/Makefile
@@ -1,17 +1,3 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
-TARGET = swigexample
-INTERFACE = example.i
-LIBS = -lm
-SWIGOPT =
+CXXSRCS =
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean
+include $(SRCDIR)../example.mk
View
16 Examples/octave/contract/Makefile
@@ -1,15 +1,3 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-SRCS = example.c
-TARGET = swigexample
-INTERFACE = example.i
+SRCS = example.c
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean
+include $(SRCDIR)../example.mk
View
18 Examples/octave/enum/Makefile
@@ -1,17 +1,3 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-CXXSRCS = example.cxx
-TARGET = swigexample
-INTERFACE = example.i
-LIBS = -lm
-SWIGOPT =
+CXXSRCS = example.cxx
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean
+include $(SRCDIR)../example.mk
View
32 Examples/octave/example.mk
@@ -0,0 +1,32 @@
+# Note: as a convention an example must be in a child directory of this.
+# These paths are relative to such an example directory
+
+TOP = ../..
+SWIG = $(TOP)/../preinst-swig
+TARGET = swigexample
+INTERFACE = example.i
+
+check: build
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run
+
+build:
+ifneq (,$(SRCS))
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave
+else
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
+endif
+ifneq (,$(TARGET2)$(SWIGOPT2))
+ifneq (,$(SRCS))
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT2)' TARGET='$(TARGET2)' INTERFACE='$(INTERFACE)' octave
+else
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
+ SWIGOPT='$(SWIGOPT2)' TARGET='$(TARGET2)' INTERFACE='$(INTERFACE)' octave_cpp
+endif
+endif
+
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean
View
18 Examples/octave/extend/Makefile
@@ -1,17 +1,3 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-CXXSRCS = example.cxx
-TARGET = swigexample
-INTERFACE = example.i
-LIBS = -lm
-SWIGOPT =
+CXXSRCS = example.cxx
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean
+include $(SRCDIR)../example.mk
View
16 Examples/octave/funcptr/Makefile
@@ -1,15 +1,3 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-SRCS = example.c
-TARGET = swigexample
-INTERFACE = example.i
+SRCS = example.c
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean
+include $(SRCDIR)../example.mk
View
16 Examples/octave/funcptr2/Makefile
@@ -1,15 +1,3 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-SRCS = example.c
-TARGET = swigexample
-INTERFACE = example.i
+SRCS = example.c
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean
+include $(SRCDIR)../example.mk
View
18 Examples/octave/functor/Makefile
@@ -1,17 +1,3 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
-TARGET = swigexample
-INTERFACE = example.i
-LIBS = -lm
-SWIGOPT =
+CXXSRCS =
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean
+include $(SRCDIR)../example.mk
View
23 Examples/octave/module_load/Makefile
@@ -1,18 +1,7 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-SRCS = example.c
-TARGET = swigexample
-INTERFACE = example.i
+SRCS = example.c
+TARGET = swigexample
+SWIGOPT = -module swigexample
+TARGET2 = swigexample2
+SWIGOPT2 = -module swigexample2 -globals .
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
- TARGET='$(TARGET)' SWIGOPT='-module $$(TARGET)' INTERFACE='$(INTERFACE)' octave
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
- TARGET='$(TARGET)2' SWIGOPT='-module $$(TARGET) -globals .' INTERFACE='$(INTERFACE)' octave
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean
- rm -f $(TARGET).m
+include $(SRCDIR)../example.mk
View
18 Examples/octave/operator/Makefile
@@ -1,17 +1,3 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
-TARGET = swigexample
-INTERFACE = example.i
-LIBS = -lm
-SWIGOPT =
+CXXSRCS =
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean
+include $(SRCDIR)../example.mk
View
16 Examples/octave/pointer/Makefile
@@ -1,15 +1,3 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-SRCS = example.c
-TARGET = swigexample
-INTERFACE = example.i
+SRCS = example.c
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean
+include $(SRCDIR)../example.mk
View
18 Examples/octave/reference/Makefile
@@ -1,17 +1,3 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-CXXSRCS = example.cxx
-TARGET = swigexample
-INTERFACE = example.i
-LIBS = -lm
-SWIGOPT =
+CXXSRCS = example.cxx
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean
+include $(SRCDIR)../example.mk
View
16 Examples/octave/simple/Makefile
@@ -1,15 +1,3 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-SRCS = example.c
-TARGET = swigexample
-INTERFACE = example.i
+SRCS = example.c
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean
+include $(SRCDIR)../example.mk
View
18 Examples/octave/template/Makefile
@@ -1,17 +1,3 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-CXXSRCS =
-TARGET = swigexample
-INTERFACE = example.i
-LIBS = -lm
-SWIGOPT =
+CXXSRCS =
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
- SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean
+include $(SRCDIR)../example.mk
View
16 Examples/octave/variables/Makefile
@@ -1,15 +1,3 @@
-TOP = ../..
-SWIG = $(TOP)/../preinst-swig
-SRCS = example.c
-TARGET = swigexample
-INTERFACE = example.i
+SRCS = example.c
-check: build
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run
-
-build:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \
- TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave
-
-clean:
- $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean
+include $(SRCDIR)../example.mk
Please sign in to comment.
Something went wrong with that request. Please try again.