After much thought and deliberation... a change in EPANET repo
policy regarding Makefiles and their output targets. Used to create library and executable file names that included the compiler (e.g., *_gcc_*) and the SVN rev (*_309_*). This was to allow development along the trunk while keeping clean track of the SVN versions that objects were made from. Maybe a good idea in part, but no longer. It collapsed under its own complexity. The need to keep track of all the specific file names became more burdensome that the need to keep track of which source actually built an object. As of now, Makefiles produce unadorned file names: Linux: lib<name>.so <name> Cygwin: cyg<name>.dll cyg<name>.exe libcyg<name>.dll.a MSVC: <name>.dll <name>.exe <name>.lib MinGW: Same as MSVC Darwin: Don't know about this, but I think they already were produced with just dy extensions Under this scheme MinGW looks just like MSVC, but I guess that's the whole point... git-svn-id: https://epanet.svn.sourceforge.net/svnroot/epanet/BASE/trunk@314 c320cabd-cc23-0410-96d8-e60fbf53ed7f
This commit is contained in:
@@ -1,35 +1,33 @@
|
||||
# Cygwin Makefile for EPANET
|
||||
|
||||
# This will build EPANET as a cygwin DLL and import
|
||||
# library (cygepanet_gcc_<Rev>.dll/libcygepanet_gcc_<Rev>.dll.a) under Cygwin/gcc,
|
||||
# and a standalone executable (cygepanet_gcc_<Rev>.exe).
|
||||
# <Rev> is the atomic revision number of the EPANET SVN repo,
|
||||
# so the results of each build can be unambiguously tracked to a repo Rev.
|
||||
# library (cygepanet.dll/libcygepanet.dll.a) under Cygwin/gcc,
|
||||
# and a standalone executable (cygepanet.exe).
|
||||
# The current release of the Cygwin environment can be
|
||||
# obtained from http://www.cygwin.com
|
||||
|
||||
# The following targets are defined (for execution in
|
||||
# the build directory under the Cygwin environment):
|
||||
# make
|
||||
# -Builds cygepanet_gcc_<Rev>.dll, cygepanet_gcc_<Rev>.def, libcygepanet_gcc_<Rev>.dll.a,
|
||||
# cygepanet_gcc_<Rev>.exe
|
||||
# -Builds cygepanet2.dll, cygepanet2.def, libcygepanet2.dll.a,
|
||||
# cygepanet2.exe
|
||||
# make install
|
||||
# -Creates shell wrapper runcygepanet_<Rev>.sh that
|
||||
# executes cygepanet_gcc_<Rev>.exe.
|
||||
# The runcygepanet_<Rev>.sh wrapper simply exports
|
||||
# -Creates shell wrapper runcygepanet2.sh that
|
||||
# executes cygepanet2.exe.
|
||||
# The runcygepanet2.sh wrapper simply exports
|
||||
# environment variables so that the DLL is found at runtime,
|
||||
# allowing you to specify your own locations for installing
|
||||
# the DLL.
|
||||
# -Installs cygepanet_gcc_<Rev>.dll, cygepanet_gcc_<Rev>.exe, and runcygepanet_<Rev>.sh
|
||||
# -Installs cygepanet2.dll, cygepanet2.exe, and runcygepanet2.sh
|
||||
# in <prefix>/bin, where <prefix> defaults to ~ (and can be set
|
||||
# below to something different - see "Install directories")
|
||||
# -Installs libcygepanet_gcc_<Rev>.dll.a (import library), and cygepanet_gcc_<Rev>.def,
|
||||
# -Installs libcygepanet2.dll.a (import library), and cygepanet2.def,
|
||||
# in <prefix>/lib
|
||||
# -Installs epanet2.h in <prefix>/include. This is the required
|
||||
# header file for the EPANET programmer's toolkit, and thus
|
||||
# <prefix>/include should be on your CPP include search path
|
||||
# for subsequent use of the toolkit and linking with the import
|
||||
# library libcygepanet_gcc_<Rev>.dll.a.
|
||||
# library libcygepanet2.dll.a.
|
||||
# make clean
|
||||
# -Removes object and library files, returning the build directory
|
||||
# to its pristine state.
|
||||
@@ -41,17 +39,14 @@ SHELL = /bin/sh
|
||||
# or the compiler flags, but these defaults should be fine.
|
||||
|
||||
# Target filenames
|
||||
# svnname.sh constructs a name: <prefix><root><Rev><postfix>
|
||||
# where <Rev> is the atomic revision number of the svn repo.
|
||||
epanetsvnpath = ../../..
|
||||
epanetrootname := $(shell ../svnname.sh $(epanetsvnpath) "" cygepanet_gcc_ "")
|
||||
epanetrootname := cygepanet2
|
||||
dllname := $(epanetrootname).dll
|
||||
defname := $(epanetrootname).def
|
||||
implibname = lib$(dllname).a
|
||||
exename := $(epanetrootname)
|
||||
# Shell wrapper
|
||||
runcmdtemplate = runepanet.sh.template
|
||||
runcmdname = $(shell ../svnname.sh $(epanetsvnpath) "" runcygepanet_ .sh)
|
||||
runcmdname = runcygepanet2.sh
|
||||
# Location of EPANET toolkit includes
|
||||
epanetincludedir = ../../include
|
||||
# Search path for sources
|
||||
|
||||
130
build/Cyg/Makefile_Rev
Executable file
130
build/Cyg/Makefile_Rev
Executable file
@@ -0,0 +1,130 @@
|
||||
# Cygwin Makefile for EPANET
|
||||
|
||||
# This will build EPANET as a cygwin DLL and import
|
||||
# library (cygepanet_gcc_<Rev>.dll/libcygepanet_gcc_<Rev>.dll.a) under Cygwin/gcc,
|
||||
# and a standalone executable (cygepanet_gcc_<Rev>.exe).
|
||||
# <Rev> is the atomic revision number of the EPANET SVN repo,
|
||||
# so the results of each build can be unambiguously tracked to a repo Rev.
|
||||
# The current release of the Cygwin environment can be
|
||||
# obtained from http://www.cygwin.com
|
||||
|
||||
# The following targets are defined (for execution in
|
||||
# the build directory under the Cygwin environment):
|
||||
# make
|
||||
# -Builds cygepanet_gcc_<Rev>.dll, cygepanet_gcc_<Rev>.def, libcygepanet_gcc_<Rev>.dll.a,
|
||||
# cygepanet_gcc_<Rev>.exe
|
||||
# make install
|
||||
# -Creates shell wrapper runcygepanet_<Rev>.sh that
|
||||
# executes cygepanet_gcc_<Rev>.exe.
|
||||
# The runcygepanet_<Rev>.sh wrapper simply exports
|
||||
# environment variables so that the DLL is found at runtime,
|
||||
# allowing you to specify your own locations for installing
|
||||
# the DLL.
|
||||
# -Installs cygepanet_gcc_<Rev>.dll, cygepanet_gcc_<Rev>.exe, and runcygepanet_<Rev>.sh
|
||||
# in <prefix>/bin, where <prefix> defaults to ~ (and can be set
|
||||
# below to something different - see "Install directories")
|
||||
# -Installs libcygepanet_gcc_<Rev>.dll.a (import library), and cygepanet_gcc_<Rev>.def,
|
||||
# in <prefix>/lib
|
||||
# -Installs epanet2.h in <prefix>/include. This is the required
|
||||
# header file for the EPANET programmer's toolkit, and thus
|
||||
# <prefix>/include should be on your CPP include search path
|
||||
# for subsequent use of the toolkit and linking with the import
|
||||
# library libcygepanet_gcc_<Rev>.dll.a.
|
||||
# make clean
|
||||
# -Removes object and library files, returning the build directory
|
||||
# to its pristine state.
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
# C H A N G E H E R E A S N E E D E D
|
||||
# You may wish to change the install path 'prefix',
|
||||
# or the compiler flags, but these defaults should be fine.
|
||||
|
||||
# Target filenames
|
||||
# svnname.sh constructs a name: <prefix><root><Rev><postfix>
|
||||
# where <Rev> is the atomic revision number of the svn repo.
|
||||
epanetsvnpath = ../../..
|
||||
epanetrootname := $(shell ../svnname.sh $(epanetsvnpath) "" cygepanet_gcc_ "")
|
||||
dllname := $(epanetrootname).dll
|
||||
defname := $(epanetrootname).def
|
||||
implibname = lib$(dllname).a
|
||||
exename := $(epanetrootname)
|
||||
# Shell wrapper
|
||||
runcmdtemplate = runepanet.sh.template
|
||||
runcmdname = $(shell ../svnname.sh $(epanetsvnpath) "" runcygepanet_ .sh)
|
||||
# Location of EPANET toolkit includes
|
||||
epanetincludedir = ../../include
|
||||
# Search path for sources
|
||||
epanetsrcdir = ../../src
|
||||
VPATH = $(epanetsrcdir):$(epanetincludedir)
|
||||
|
||||
# Install directories
|
||||
prefix = ~
|
||||
exec_prefix = $(prefix)
|
||||
srcdir = .
|
||||
libdir = $(exec_prefix)/lib
|
||||
bindir = $(exec_prefix)/bin
|
||||
includedir = $(prefix)/include
|
||||
datarootdir = $(prefix)/share
|
||||
docdir = $(datarootdir)/doc/epanet
|
||||
|
||||
# Compiler and flags
|
||||
CC = /bin/gcc
|
||||
dlltool = /bin/dlltool
|
||||
CFLAGS = -g -O3
|
||||
CPPFLAGS = -I $(srcdir) -I $(epanetincludedir)
|
||||
LDFLAGS = -L . -W1,-rpath,$(libdir) -lm
|
||||
|
||||
# Installer
|
||||
INSTALL = install
|
||||
INSTALL_PROGRAM = $(INSTALL)
|
||||
INSTALL_DATA = $(INSTALL) -m 644
|
||||
|
||||
# EPANET object files
|
||||
epanet_objs=hash.o hydraul.o inpfile.o input1.o input2.o \
|
||||
input3.o mempool.o output.o quality.o report.o \
|
||||
rules.o smatrix.o
|
||||
# Epanet header files
|
||||
epanet_heads=enumstxt.h funcs.h hash.h mempool.h text.h toolkit.h types.h vars.h
|
||||
epanet_main_heads=epanet2.h
|
||||
# Epanet main program
|
||||
epanet_main=epanet
|
||||
|
||||
.PHONY: all
|
||||
all: $(dllname) $(exename)
|
||||
|
||||
$(dllname): $(epanet_objs)
|
||||
# $(dlltool) -z $(defname) --dllname $(dllname) --output-lib $(implibname) $^
|
||||
# $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $(defname) $^
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -D SOL -c $(epanetsrcdir)/$(epanet_main).c
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $(epanet_main).o $^ -Wl,--output-def,$(defname)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $(epanet_main).o $^ -Wl,--kill-at
|
||||
$(dlltool) -d $(defname) --dllname $@ --output-lib $(implibname) --kill-at
|
||||
|
||||
$(exename): $(epanet_objs)
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -D CLE -c $(epanetsrcdir)/$(epanet_main).c
|
||||
$(CC) $(CFLAGS) -o $@ $(epanet_main).o $^ $(LDFLAGS)
|
||||
|
||||
$(epanet_objs): $(epanet_heads)
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
cat $(runcmdtemplate) | sed 's|libdir|$(bindir)|' \
|
||||
| sed 's|exename|$(bindir)/$(exename)|' \
|
||||
> $(runcmdname)
|
||||
$(INSTALL_PROGRAM) -D $(exename) $(bindir)/$(exename)
|
||||
$(INSTALL_PROGRAM) -D $(dllname) $(bindir)/$(dllname)
|
||||
$(INSTALL_PROGRAM) -D $(defname) $(libdir)/$(defname)
|
||||
$(INSTALL_PROGRAM) -D $(implibname) $(libdir)/$(implibname)
|
||||
$(INSTALL_DATA) -D $(epanetincludedir)/epanet2.h $(includedir)/epanet2.h
|
||||
$(INSTALL_PROGRAM) -D $(runcmdname) $(bindir)/$(runcmdname)
|
||||
|
||||
.PHONY: uninstall
|
||||
uninstall:
|
||||
|
||||
.PHONY: check
|
||||
check:
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
-/bin/rm *.o $(dllname) $(defname) $(implibname) $(exename).exe $(runcmdname)
|
||||
@@ -1,26 +1,26 @@
|
||||
# Linux Makefile for EPANET
|
||||
|
||||
# This will build EPANET as a shared object library
|
||||
# (libepanet_gcc_<Rev>.so) under Linux/Unix, and a standalone
|
||||
# executable (epanet_gcc_<Rev>).
|
||||
# (libepanet2.so) under Linux/Unix, and a standalone
|
||||
# executable (epanet2).
|
||||
|
||||
# The following targets are defined:
|
||||
# make
|
||||
# -Builds libepanet_gcc_<Rev>.so, epanet_gcc_<Rev>
|
||||
# -Builds libepanet2.so, epanet2
|
||||
# make install
|
||||
# -Creates shell wrapper runepanet_<Rev>.sh that executes epanet_gcc_<Rev>.exe.
|
||||
# The runepanet_<Rev>.sh wrapper simply exports
|
||||
# -Creates shell wrapper runepanet2.sh that executes epanet2.
|
||||
# The runepanet2.sh wrapper simply exports
|
||||
# environment variables that help locate the runtime library,
|
||||
# allowing you to specify your own library locations.
|
||||
# -Installs epanet_gcc_<Rev> and runepanet_<Rev>.sh
|
||||
# -Installs epanet2 and runepanet2.sh
|
||||
# in <prefix>/bin, where <prefix> defaults to ~ (and can be set
|
||||
# below to something different - see "Install directories")
|
||||
# -Installs libepanet_gcc_<Rev>.so in <prefix>/lib
|
||||
# -Installs libepanet2.so in <prefix>/lib
|
||||
# -Installs epanet2.h in <prefix>/include. This is the required
|
||||
# header file for the EPANET programmer's toolkit, and thus
|
||||
# <prefix>/include should be on your CPP include search path
|
||||
# for subsequent use of the toolkit and linking with the
|
||||
# library libepanet_gcc_<Rev>.so
|
||||
# library libepanet2.so
|
||||
# make clean
|
||||
# -Removes object and library files, returning the build directory
|
||||
# to its pristine state.
|
||||
@@ -31,15 +31,12 @@
|
||||
SHELL = /bin/sh
|
||||
|
||||
# Target filenames
|
||||
# svnname.sh constructs a name: <prefix><root><Rev><postfix>
|
||||
# where <Rev> is the atomic revision number of the svn repo.
|
||||
epanetsvnpath = ../../..
|
||||
epanetrootname := $(shell ../svnname.sh $(epanetsvnpath) "" epanet_gcc_ "")
|
||||
epanetrootname := epanet2
|
||||
libname := lib$(epanetrootname).so
|
||||
exename := $(epanetrootname)
|
||||
# Shell wrapper
|
||||
runcmdtemplate = runepanet.sh.template
|
||||
runcmdname = $(shell ../svnname.sh $(epanetsvnpath) "" runepanet_ .sh)
|
||||
runcmdname = runepanet2.sh
|
||||
# Location of EPANET toolkit includes
|
||||
epanetincludedir = ../../include
|
||||
# Search path for sources
|
||||
|
||||
111
build/Linux/Makefile_Rev
Executable file
111
build/Linux/Makefile_Rev
Executable file
@@ -0,0 +1,111 @@
|
||||
# Linux Makefile for EPANET
|
||||
|
||||
# This will build EPANET as a shared object library
|
||||
# (libepanet_gcc_<Rev>.so) under Linux/Unix, and a standalone
|
||||
# executable (epanet_gcc_<Rev>).
|
||||
|
||||
# The following targets are defined:
|
||||
# make
|
||||
# -Builds libepanet_gcc_<Rev>.so, epanet_gcc_<Rev>
|
||||
# make install
|
||||
# -Creates shell wrapper runepanet_<Rev>.sh that executes epanet_gcc_<Rev>.exe.
|
||||
# The runepanet_<Rev>.sh wrapper simply exports
|
||||
# environment variables that help locate the runtime library,
|
||||
# allowing you to specify your own library locations.
|
||||
# -Installs epanet_gcc_<Rev> and runepanet_<Rev>.sh
|
||||
# in <prefix>/bin, where <prefix> defaults to ~ (and can be set
|
||||
# below to something different - see "Install directories")
|
||||
# -Installs libepanet_gcc_<Rev>.so in <prefix>/lib
|
||||
# -Installs epanet2.h in <prefix>/include. This is the required
|
||||
# header file for the EPANET programmer's toolkit, and thus
|
||||
# <prefix>/include should be on your CPP include search path
|
||||
# for subsequent use of the toolkit and linking with the
|
||||
# library libepanet_gcc_<Rev>.so
|
||||
# make clean
|
||||
# -Removes object and library files, returning the build directory
|
||||
# to its pristine state.
|
||||
|
||||
# You may wish to change the install path 'prefix',
|
||||
# or the compiler flags, but these defaults should be fine.
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
# Target filenames
|
||||
# svnname.sh constructs a name: <prefix><root><Rev><postfix>
|
||||
# where <Rev> is the atomic revision number of the svn repo.
|
||||
epanetsvnpath = ../../..
|
||||
epanetrootname := $(shell ../svnname.sh $(epanetsvnpath) "" epanet_gcc_ "")
|
||||
libname := lib$(epanetrootname).so
|
||||
exename := $(epanetrootname)
|
||||
# Shell wrapper
|
||||
runcmdtemplate = runepanet.sh.template
|
||||
runcmdname = $(shell ../svnname.sh $(epanetsvnpath) "" runepanet_ .sh)
|
||||
# Location of EPANET toolkit includes
|
||||
epanetincludedir = ../../include
|
||||
# Search path for sources
|
||||
epanetsrcdir = ../../src
|
||||
VPATH = $(epanetsrcdir):$(epanetincludedir)
|
||||
|
||||
# Install directories
|
||||
prefix = ~
|
||||
exec_prefix = $(prefix)
|
||||
libdir = $(exec_prefix)/lib
|
||||
bindir = $(exec_prefix)/bin
|
||||
includedir = $(prefix)/include
|
||||
datarootdir = $(prefix)/share
|
||||
docdir = $(datarootdir)/doc/epanet
|
||||
|
||||
# Compiler and flags
|
||||
CC = gcc
|
||||
CFLAGS = -g -O3 -fPIC
|
||||
CPPFLAGS = -I $(epanetincludedir)
|
||||
LDFLAGS = -L . -W1,-rpath,$(libdir) -lm
|
||||
|
||||
# Installer
|
||||
INSTALL = install
|
||||
INSTALL_PROGRAM = $(INSTALL)
|
||||
INSTALL_DATA = $(INSTALL) -m 644
|
||||
|
||||
# Files for the shared object library
|
||||
epanet_objs=hash.o hydraul.o inpfile.o input1.o input2.o \
|
||||
input3.o mempool.o output.o quality.o report.o \
|
||||
rules.o smatrix.o
|
||||
# Epanet header files
|
||||
epanet_heads=enumstxt.h funcs.h hash.h mempool.h text.h toolkit.h types.h vars.h
|
||||
# Epanet main program
|
||||
epanet_main=epanet
|
||||
# Epanet main program header files
|
||||
epanet_main_heads=epanet2.h
|
||||
|
||||
.PHONY: all
|
||||
all: $(libname) $(exename)
|
||||
|
||||
$(libname): $(epanet_objs)
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -D SOL -c $(epanetsrcdir)/$(epanet_main).c
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $(epanet_main).o $^
|
||||
|
||||
$(exename): $(libname) $(epanet_main_heads)
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -D CLE -c $(epanetsrcdir)/$(epanet_main).c
|
||||
$(CC) $(CFLAGS) -o $@ $(epanet_main).o -l$(epanetrootname) $(LDFLAGS)
|
||||
|
||||
$(epanet_objs): $(epanet_heads)
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
cat $(runcmdtemplate) | sed 's|libdir|$(libdir)|' \
|
||||
| sed 's|exename|$(bindir)/$(exename)|' \
|
||||
> $(runcmdname)
|
||||
$(INSTALL_PROGRAM) -D $(exename) $(bindir)/$(exename)
|
||||
$(INSTALL_PROGRAM) -D $(libname) $(libdir)/$(libname)
|
||||
$(INSTALL_DATA) -D $(epanetincludedir)/epanet2.h $(includedir)/epanet2.h
|
||||
$(INSTALL_PROGRAM) -D $(runcmdname) $(bindir)/$(runcmdname)
|
||||
|
||||
.PHONY: uninstall
|
||||
uninstall:
|
||||
|
||||
.PHONY: check
|
||||
check:
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
-/bin/rm *.o $(libname) $(exename) $(runcmdname)
|
||||
@@ -88,6 +88,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="copy .\Release\epanet2.dll "%HOME%"\bin
copy .\Release\epanet2.lib "%HOME%"\lib
copy ..\..\..\include\epanet2.h "%HOME%"\include"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
@@ -166,7 +167,7 @@
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="Installing Library Files..."
|
||||
CommandLine="copy .\Release\epanet2.dll "%HOME%"\bin
copy .\Release\epanet2.lib "%HOME%"\lib"
|
||||
CommandLine="copy .\Release\epanet2.dll "%HOME%"\bin
copy .\Release\epanet2.lib "%HOME%"\lib
copy ..\..\..\include\epanet2.h "%HOME%"\include"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="copy .\Debug\epanet2.exe "%HOME%"\bin
"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
|
||||
@@ -1,43 +1,48 @@
|
||||
# Cygwin/MinGW Makefile for EPANET
|
||||
# MinGW Makefile for EPANET
|
||||
|
||||
# Note: This makefile usese MinGW to produce native windows
|
||||
# libraries and executables. The dll/import library, and
|
||||
# executable files will have the same names as those produced
|
||||
# using other Windows compilers, e.g. MSVC++. So be aware that
|
||||
# there is no way to reliably distinguish between these two compiler
|
||||
# sources based on output filenames.
|
||||
|
||||
# This will build EPANET as a native windows DLL and import
|
||||
# library (epanet_gcc_<Rev>.dll/libepanet_gcc_<Rev>.dll.a) under Cygwin/MinGW,
|
||||
# and a standalone executable (epanet_gcc_<Rev>.exe).
|
||||
# <Rev> is the atomic revision number of the EPANET SVN repo,
|
||||
# so the results of each build can be unambiguously tracked to a repo Rev.
|
||||
# library (epanet2.dll/libepanet2.dll.a) using MinGW/gcc,
|
||||
# and a standalone executable (epanet2.exe).
|
||||
# This makefile also creates a windows batch file
|
||||
# (see MScmdname below) that will produce an import
|
||||
# (see MScmdname below) that can be run to produce an import
|
||||
# library for linking the DLL using MSVC.
|
||||
# This makefile assumes a Cygwin environment with minimal
|
||||
# This makefile assumes a minimum
|
||||
# MinGW installation, and uses the MinGW gcc compiler from
|
||||
# the MinGW install directory.
|
||||
# The current release of MinGW can be obtained from
|
||||
# http://sourceforge.net/project/showfiles.php?group_id=2435
|
||||
# The current release of the Cygwin environment can be
|
||||
# obtained from http://www.cygwin.com
|
||||
# http://www.mingw.org/wiki/Getting_Started -- the easiest
|
||||
# approach is to download the latest MingW installer and
|
||||
# accept all of the defaults.
|
||||
|
||||
# The following targets are defined (for execution in
|
||||
# the build directory under the Cygwin environment):
|
||||
# the build directory):
|
||||
# make
|
||||
# -Builds epanet_gcc_<Rev>.dll, epanet_gcc_<Rev>.def, libepanet_gcc_<Rev>.dll.a,
|
||||
# epanet_gcc_<Rev>.exe
|
||||
# -Builds epanet2.dll, epanet2.def, libepanet2.dll.a,
|
||||
# epanet2.exe
|
||||
# make install
|
||||
# -Creates shell wrappers runepanet_<Rev>.sh and CreateMSLib_<Rev>.bat that
|
||||
# execute epanet_gcc_<Rev>.exe, and MSVC 'lib' (to create an MSVC
|
||||
# import library). The runepanet_<Rev>.sh wrapper simply exports
|
||||
# -Creates scripts runepanet2.sh and CreateEpanet2Lib.bat that
|
||||
# execute epanet2.exe, and MSVC 'lib' (to create an MSVC
|
||||
# import library). The runepanet2.sh wrapper simply exports
|
||||
# environment variables so that the DLL is found at runtime,
|
||||
# allowing you to specify your own locations for installing
|
||||
# the DLL.
|
||||
# -Installs epanet_gcc_<Rev>.dll, epanet_gcc_<Rev>.exe, and runepanet_<Rev>.sh
|
||||
# -Installs epanet2.dll, epanet2.exe, and runepanet2.sh
|
||||
# in <prefix>/bin, where <prefix> defaults to ~ (and can be set
|
||||
# below to something different - see "Install directories")
|
||||
# -Installs libepanet_gcc_<Rev>.dll.a (import library), epanet_gcc_<Rev>.def,
|
||||
# and CreateMSLib-<Rev>.bat in <prefix>/lib
|
||||
# -Installs libepanet2.dll.a (import library), epanet2.def,
|
||||
# and CreateEpanet2Lib.bat in <prefix>/lib
|
||||
# -Installs epanet2.h in <prefix>/include. This is the required
|
||||
# header file for the EPANET programmer's toolkit, and thus
|
||||
# <prefix>/include should be on your CPP include search path
|
||||
# for subsequent use of the toolkit and linking with the import
|
||||
# library libepanet_gcc_<Rev>.dll.a.
|
||||
# library libepanet2.dll.a or epanet2.lib.
|
||||
# make clean
|
||||
# -Removes object and library files, returning the build directory
|
||||
# to its pristine state.
|
||||
@@ -53,23 +58,22 @@ SHELL = /bin/sh
|
||||
# MinGW top level install directory, accessible from build environment
|
||||
MinGWdir = /cygdrive/c/MinGW
|
||||
# Microsoft lib tool directory (for creating an MS import library)
|
||||
MSVClibexe = c:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\bin\\lib
|
||||
MSVClibexe = c:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\bin\\lib
|
||||
|
||||
# Target filenames
|
||||
# svnname.sh constructs a name: <prefix><root><Rev><postfix>
|
||||
# where <Rev> is the atomic revision number of the svn repo.
|
||||
epanetsvnpath = ../../..
|
||||
epanetrootname := $(shell ../svnname.sh $(epanetsvnpath) "" epanet_gcc_ "")
|
||||
epanetrootname := epanet2
|
||||
dllname := $(epanetrootname).dll
|
||||
defname := $(epanetrootname).def
|
||||
implibname = lib$(dllname).a
|
||||
exename := $(epanetrootname)
|
||||
# Shell wrapper
|
||||
runcmdtemplate = runepanet.sh.template
|
||||
runcmdname = $(shell ../svnname.sh $(epanetsvnpath) "" runepanet_ .sh)
|
||||
runcmdname = runepanet2.sh
|
||||
# MSVC import lib batch file
|
||||
MScmdtemplate = CreateMSLib.bat.template
|
||||
MScmdname = $(shell ../svnname.sh $(epanetsvnpath) "" CreateMSLib_ .bat)
|
||||
MScmdname = CreateEpanet2Lib.bat
|
||||
# Location of EPANET toolkit includes
|
||||
epanetincludedir = ../../include
|
||||
# Search path for sources
|
||||
|
||||
159
build/MingW/Makefile_Rev
Executable file
159
build/MingW/Makefile_Rev
Executable file
@@ -0,0 +1,159 @@
|
||||
# Cygwin/MinGW Makefile for EPANET
|
||||
|
||||
# This will build EPANET as a native windows DLL and import
|
||||
# library (epanet_gcc_<Rev>.dll/libepanet_gcc_<Rev>.dll.a) under Cygwin/MinGW,
|
||||
# and a standalone executable (epanet_gcc_<Rev>.exe).
|
||||
# <Rev> is the atomic revision number of the EPANET SVN repo,
|
||||
# so the results of each build can be unambiguously tracked to a repo Rev.
|
||||
# This makefile also creates a windows batch file
|
||||
# (see MScmdname below) that will produce an import
|
||||
# library for linking the DLL using MSVC.
|
||||
# This makefile assumes a Cygwin environment with minimal
|
||||
# MinGW installation, and uses the MinGW gcc compiler from
|
||||
# the MinGW install directory.
|
||||
# The current release of MinGW can be obtained from
|
||||
# http://www.mingw.org/wiki/Getting_Started -- the easiest
|
||||
# approach is to download the latest MingW installer and
|
||||
# accept all of the defaults.
|
||||
# The current release of the Cygwin environment can be
|
||||
# obtained from http://www.cygwin.com
|
||||
|
||||
# The following targets are defined (for execution in
|
||||
# the build directory under the Cygwin environment):
|
||||
# make
|
||||
# -Builds epanet_gcc_<Rev>.dll, epanet_gcc_<Rev>.def, libepanet_gcc_<Rev>.dll.a,
|
||||
# epanet_gcc_<Rev>.exe
|
||||
# make install
|
||||
# -Creates shell wrappers runepanet_<Rev>.sh and CreateMSLib_<Rev>.bat that
|
||||
# execute epanet_gcc_<Rev>.exe, and MSVC 'lib' (to create an MSVC
|
||||
# import library). The runepanet_<Rev>.sh wrapper simply exports
|
||||
# environment variables so that the DLL is found at runtime,
|
||||
# allowing you to specify your own locations for installing
|
||||
# the DLL.
|
||||
# -Installs epanet_gcc_<Rev>.dll, epanet_gcc_<Rev>.exe, and runepanet_<Rev>.sh
|
||||
# in <prefix>/bin, where <prefix> defaults to ~ (and can be set
|
||||
# below to something different - see "Install directories")
|
||||
# -Installs libepanet_gcc_<Rev>.dll.a (import library), epanet_gcc_<Rev>.def,
|
||||
# and CreateMSLib-<Rev>.bat in <prefix>/lib
|
||||
# -Installs epanet2.h in <prefix>/include. This is the required
|
||||
# header file for the EPANET programmer's toolkit, and thus
|
||||
# <prefix>/include should be on your CPP include search path
|
||||
# for subsequent use of the toolkit and linking with the import
|
||||
# library libepanet_gcc_<Rev>.dll.a.
|
||||
# make clean
|
||||
# -Removes object and library files, returning the build directory
|
||||
# to its pristine state.
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
# C H A N G E H E R E A S N E E D E D
|
||||
# Change (as needed) the MinGW install directory below.
|
||||
# Change (as needed) the location off the MS LIB tool.
|
||||
# You may also wish to change the install path 'prefix',
|
||||
# or the compiler flags, but these defaults should be fine.
|
||||
|
||||
# MinGW top level install directory, accessible from build environment
|
||||
MinGWdir = /cygdrive/c/MinGW
|
||||
# Microsoft lib tool directory (for creating an MS import library)
|
||||
MSVClibexe = c:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\bin\\lib
|
||||
|
||||
# Target filenames
|
||||
# svnname.sh constructs a name: <prefix><root><Rev><postfix>
|
||||
# where <Rev> is the atomic revision number of the svn repo.
|
||||
epanetsvnpath = ../../..
|
||||
epanetrootname := $(shell ../svnname.sh $(epanetsvnpath) "" epanet_gcc_ "")
|
||||
dllname := $(epanetrootname).dll
|
||||
defname := $(epanetrootname).def
|
||||
implibname = lib$(dllname).a
|
||||
exename := $(epanetrootname)
|
||||
# Shell wrapper
|
||||
runcmdtemplate = runepanet.sh.template
|
||||
runcmdname = $(shell ../svnname.sh $(epanetsvnpath) "" runepanet_ .sh)
|
||||
# MSVC import lib batch file
|
||||
MScmdtemplate = CreateMSLib.bat.template
|
||||
MScmdname = $(shell ../svnname.sh $(epanetsvnpath) "" CreateEpanetLib_ .bat)
|
||||
# Location of EPANET toolkit includes
|
||||
epanetincludedir = ../../include
|
||||
# Search path for sources
|
||||
epanetsrcdir = ../../src
|
||||
VPATH = $(epanetsrcdir):$(epanetincludedir)
|
||||
|
||||
# Install directories
|
||||
winprefix = $(shell cygpath -w $$HOME)
|
||||
prefix = ~
|
||||
exec_prefix = $(prefix)
|
||||
srcdir = .
|
||||
libdir = $(exec_prefix)/lib
|
||||
winlibdir = "$(winprefix)\lib"
|
||||
bindir = $(exec_prefix)/bin
|
||||
includedir = $(prefix)/include
|
||||
winincludedir = "$(winprefix)\include"
|
||||
datarootdir = $(prefix)/share
|
||||
docdir = $(datarootdir)/doc/epanet
|
||||
|
||||
# Compiler and flags
|
||||
# MinGW gcc
|
||||
CC = $(MinGWdir)/bin/gcc
|
||||
dlltool = $(MinGWdir)/bin/dlltool
|
||||
CFLAGS = -g -O3
|
||||
CPPFLAGS = -I $(srcdir) -I $(epanetincludedir)
|
||||
LDFLAGS = -L . -W1,-rpath,$(libdir) -lm
|
||||
|
||||
# Installer
|
||||
INSTALL = install
|
||||
INSTALL_PROGRAM = $(INSTALL)
|
||||
INSTALL_DATA = $(INSTALL) -m 644
|
||||
|
||||
# EPANET object files
|
||||
epanet_objs=hash.o hydraul.o inpfile.o input1.o input2.o \
|
||||
input3.o mempool.o output.o quality.o report.o \
|
||||
rules.o smatrix.o
|
||||
# Epanet header files
|
||||
epanet_heads=enumstxt.h funcs.h hash.h mempool.h text.h toolkit.h types.h vars.h
|
||||
epanet_main_heads=epanet2.h
|
||||
# Epanet main program
|
||||
epanet_main=epanet
|
||||
|
||||
.PHONY: all
|
||||
all: $(dllname) $(exename)
|
||||
|
||||
$(dllname): $(epanet_objs)
|
||||
# $(dlltool) -z $(defname) --dllname $(dllname) --output-lib $(implibname) $^
|
||||
# $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $(defname) $^
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -D DLL -c $(epanetsrcdir)/epanet.c
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ epanet.o $^ -Wl,--output-def,$(defname)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ epanet.o $^ -Wl,--kill-at
|
||||
$(dlltool) -d $(defname) --dllname $@ --output-lib $(implibname) --kill-at
|
||||
|
||||
$(exename): $(epanet_objs)
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) -D CLE -c $(epanetsrcdir)/$(epanet_main).c
|
||||
$(CC) $(CFLAGS) -o $@ $(epanet_main).o $^ $(LDFLAGS)
|
||||
|
||||
$(epanet_objs): $(epanet_heads)
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
cat $(runcmdtemplate) | sed 's|libdir|$(bindir)|' \
|
||||
| sed 's|exename|$(bindir)/$(exename)|' \
|
||||
> $(runcmdname)
|
||||
cat $(MScmdtemplate) | sed 's|MSVClibexe|$(MSVClibexe)|' \
|
||||
| sed 's|defname|$(defname)|' \
|
||||
| sed 's|libdir|$(libdir)|' \
|
||||
> $(MScmdname)
|
||||
$(INSTALL_PROGRAM) -D $(exename) $(bindir)/$(exename)
|
||||
$(INSTALL_PROGRAM) -D $(dllname) $(bindir)/$(dllname)
|
||||
$(INSTALL_PROGRAM) -D $(defname) $(libdir)/$(defname)
|
||||
$(INSTALL_PROGRAM) -D $(implibname) $(libdir)/$(implibname)
|
||||
$(INSTALL_DATA) -D $(epanetincludedir)/epanet2.h $(includedir)/epanet2.h
|
||||
$(INSTALL_PROGRAM) -D $(runcmdname) $(bindir)/$(runcmdname)
|
||||
$(INSTALL_PROGRAM) -D $(MScmdname) $(libdir)/$(MScmdname)
|
||||
|
||||
.PHONY: uninstall
|
||||
uninstall:
|
||||
|
||||
.PHONY: check
|
||||
check:
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
-/bin/rm *.o $(dllname) $(defname) $(implibname) $(exename).exe $(runcmdname) $(MScmdname)
|
||||
Reference in New Issue
Block a user