D: Fix out-of-source build for examples.

This commit is contained in:
David Nadlinger 2014-11-01 01:39:42 +01:00
commit 86276568df
12 changed files with 61 additions and 240 deletions

View file

@ -1,27 +1 @@
ifeq (2,$(D_VERSION))
WORKING_DIR = d2/
else
WORKING_DIR = d1/
endif
TOP = ../../..
SWIG = $(TOP)/../preinst-swig
EXTRA_CFLAGS = -I../ example_wrap.c
EXTRA_LDFLAGS = example_wrap.o
TARGET = example_wrap
SWIGOPT =
DSRCS = *.d
DFLAGS = -ofrunme
check: build
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' d_run
build:
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -outcurrentdir ../example.i' TARGET='$(TARGET)' d; \
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' DSRCS='$(DSRCS)' DFLAGS='$(DFLAGS)' d_compile
clean:
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' d_clean
include ../example.mk

View file

@ -1,23 +0,0 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 1.3.41
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
module example;
static import example_wrap;
static import tango.stdc.stringz;
public const int ICONST = 42;
public const double FCONST = 2.1828;
public const char CCONST = 'x';
public const char CCONST2 = '\n';
public const char[] SCONST = "Hello World";
public const char[] SCONST2 = "\"Hello World\"";
public const double EXPR = 42+3*(2.1828);
public const int iconst = 37;
public const double fconst = 3.14;