Commit e80dc40503c17559930c881df993dce410d67494
1 parent
795d1fd7
Rename modbus/ to src/
- upgrade to WAF 1.5.3 - smaller WAF scripts - fix using of modbus.h with WAF - updated configure.ac and Makefile.am files - change include paths in test files
Showing
18 changed files
with
55 additions
and
93 deletions
Makefile.am
configure.ac
| @@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
| 3 | 3 | ||
| 4 | AC_PREREQ(2.59) | 4 | AC_PREREQ(2.59) |
| 5 | AC_INIT(libmodbus, 2.0.3, stephane.raimbault@gmail.com) | 5 | AC_INIT(libmodbus, 2.0.3, stephane.raimbault@gmail.com) |
| 6 | -AC_CONFIG_SRCDIR([modbus/modbus.c]) | 6 | +AC_CONFIG_SRCDIR([src/modbus.c]) |
| 7 | AM_INIT_AUTOMAKE | 7 | AM_INIT_AUTOMAKE |
| 8 | AM_DISABLE_STATIC | 8 | AM_DISABLE_STATIC |
| 9 | 9 | ||
| @@ -28,7 +28,7 @@ AC_CHECK_FUNCS([inet_ntoa memset select socket]) | @@ -28,7 +28,7 @@ AC_CHECK_FUNCS([inet_ntoa memset select socket]) | ||
| 28 | 28 | ||
| 29 | AC_OUTPUT([ | 29 | AC_OUTPUT([ |
| 30 | Makefile | 30 | Makefile |
| 31 | - modbus/Makefile | 31 | + src/Makefile |
| 32 | tests/Makefile | 32 | tests/Makefile |
| 33 | modbus.pc | 33 | modbus.pc |
| 34 | ]) | 34 | ]) |
modbus/wscript deleted
modbus/Makefile.am renamed to src/Makefile.am
modbus/modbus.c renamed to src/modbus.c
modbus/modbus.h renamed to src/modbus.h
src/wscript
0 → 100644
tests/Makefile.am
| @@ -10,7 +10,7 @@ noinst_PROGRAMS = \ | @@ -10,7 +10,7 @@ noinst_PROGRAMS = \ | ||
| 10 | bandwidth-master | 10 | bandwidth-master |
| 11 | 11 | ||
| 12 | common_ldflags = \ | 12 | common_ldflags = \ |
| 13 | - $(top_builddir)/modbus/libmodbus.la | 13 | + $(top_builddir)/src/libmodbus.la |
| 14 | 14 | ||
| 15 | random_test_slave_SOURCES = random-test-slave.c | 15 | random_test_slave_SOURCES = random-test-slave.c |
| 16 | random_test_slave_LDADD = $(common_ldflags) | 16 | random_test_slave_LDADD = $(common_ldflags) |
| @@ -33,5 +33,5 @@ bandwidth_slave_many_up_LDADD = $(common_ldflags) | @@ -33,5 +33,5 @@ bandwidth_slave_many_up_LDADD = $(common_ldflags) | ||
| 33 | bandwidth_master_SOURCES = bandwidth-master.c | 33 | bandwidth_master_SOURCES = bandwidth-master.c |
| 34 | bandwidth_master_LDADD = $(common_ldflags) | 34 | bandwidth_master_LDADD = $(common_ldflags) |
| 35 | 35 | ||
| 36 | -INCLUDES = -I$(top_srcdir) | 36 | +INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src |
| 37 | CLEANFILES = *~ | 37 | CLEANFILES = *~ |
tests/bandwidth-master.c
| @@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
| 22 | #include <time.h> | 22 | #include <time.h> |
| 23 | #include <sys/time.h> | 23 | #include <sys/time.h> |
| 24 | 24 | ||
| 25 | -#include <modbus/modbus.h> | 25 | +#include "modbus.h" |
| 26 | 26 | ||
| 27 | /* Tests based on PI-MBUS-300 documentation */ | 27 | /* Tests based on PI-MBUS-300 documentation */ |
| 28 | #define SLAVE 0x11 | 28 | #define SLAVE 0x11 |
tests/bandwidth-slave-many-up.c
tests/bandwidth-slave-one.c
tests/random-test-master.c
| @@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
| 20 | #include <string.h> | 20 | #include <string.h> |
| 21 | #include <stdlib.h> | 21 | #include <stdlib.h> |
| 22 | 22 | ||
| 23 | -#include <modbus/modbus.h> | 23 | +#include "modbus.h" |
| 24 | 24 | ||
| 25 | /* The goal of this program is to check all major functions of | 25 | /* The goal of this program is to check all major functions of |
| 26 | libmodbus: | 26 | libmodbus: |
tests/random-test-slave.c
tests/unit-test-master.c
| @@ -20,8 +20,7 @@ | @@ -20,8 +20,7 @@ | ||
| 20 | #include <string.h> | 20 | #include <string.h> |
| 21 | #include <stdlib.h> | 21 | #include <stdlib.h> |
| 22 | 22 | ||
| 23 | -#include <modbus/modbus.h> | ||
| 24 | - | 23 | +#include "modbus.h" |
| 25 | #include "unit-test.h" | 24 | #include "unit-test.h" |
| 26 | 25 | ||
| 27 | /* Tests based on PI-MBUS-300 documentation */ | 26 | /* Tests based on PI-MBUS-300 documentation */ |
tests/unit-test-slave.c
tests/wscript
| 1 | def build(bld): | 1 | def build(bld): |
| 2 | - obj = bld.create_obj('cc', 'program') | ||
| 3 | - obj.source = 'random-test-slave.c' | ||
| 4 | - obj.includes = '. ..' | ||
| 5 | - obj.uselib_local = 'modbus' | ||
| 6 | - obj.target = 'random-test-slave' | ||
| 7 | - obj.inst_var = 0 | 2 | + programs = ('random-test-slave', |
| 3 | + 'unit-test-slave', | ||
| 4 | + 'unit-test-master', | ||
| 5 | + 'bandwidth-slave-one', | ||
| 6 | + 'bandwidth-slave-many-up', | ||
| 7 | + 'bandwidth-master') | ||
| 8 | 8 | ||
| 9 | - obj = bld.create_obj('cc', 'program') | ||
| 10 | - obj.source = 'random-test-master.c' | ||
| 11 | - obj.includes = '. ..' | ||
| 12 | - obj.uselib_local = 'modbus' | ||
| 13 | - obj.target = 'random-test-master' | ||
| 14 | - obj.inst_var = 0 | ||
| 15 | - | ||
| 16 | - obj = bld.create_obj('cc', 'program') | ||
| 17 | - obj.source = 'unit-test-slave.c' | ||
| 18 | - obj.includes = '. ..' | ||
| 19 | - obj.uselib_local = 'modbus' | ||
| 20 | - obj.target = 'unit-test-slave' | ||
| 21 | - obj.inst_var = 0 | ||
| 22 | - | ||
| 23 | - obj = bld.create_obj('cc', 'program') | ||
| 24 | - obj.source = 'unit-test-master.c' | ||
| 25 | - obj.includes = '. ..' | ||
| 26 | - obj.uselib_local = 'modbus' | ||
| 27 | - obj.target = 'unit-test-master' | ||
| 28 | - obj.inst_var = 0 | ||
| 29 | - | ||
| 30 | - obj = bld.create_obj('cc', 'program') | ||
| 31 | - obj.source = 'bandwidth-slave-one.c' | ||
| 32 | - obj.includes = '. ..' | ||
| 33 | - obj.uselib_local = 'modbus' | ||
| 34 | - obj.target = 'bandwidth-slave-one' | ||
| 35 | - obj.inst_var = 0 | ||
| 36 | - | ||
| 37 | - obj = bld.create_obj('cc', 'program') | ||
| 38 | - obj.source = 'bandwidth-slave-many-up.c' | ||
| 39 | - obj.includes = '. ..' | ||
| 40 | - obj.uselib_local = 'modbus' | ||
| 41 | - obj.target = 'bandwidth-slave-many-up' | ||
| 42 | - obj.inst_var = 0 | ||
| 43 | - | ||
| 44 | - obj = bld.create_obj('cc', 'program') | ||
| 45 | - obj.source = 'bandwidth-master.c' | ||
| 46 | - obj.includes = '. ..' | ||
| 47 | - obj.uselib_local = 'modbus' | ||
| 48 | - obj.target = 'bandwidth-master' | ||
| 49 | - obj.inst_var = 0 | 9 | + for program in programs: |
| 10 | + obj = bld.new_task_gen( | ||
| 11 | + features = 'cc cprogram', | ||
| 12 | + source = program + '.c', | ||
| 13 | + target = program, | ||
| 14 | + includes = '. ../src', | ||
| 15 | + uselib_local = 'modbus', | ||
| 16 | + install_path='') |
No preview for this file type
wscript
| @@ -24,23 +24,19 @@ def configure(conf): | @@ -24,23 +24,19 @@ def configure(conf): | ||
| 24 | # check for headers and append found headers to headers_found for later use | 24 | # check for headers and append found headers to headers_found for later use |
| 25 | headers_found = [] | 25 | headers_found = [] |
| 26 | for header in headers.split(): | 26 | for header in headers.split(): |
| 27 | - if conf.check_header(header): | 27 | + if conf.check_cc(header_name=header): |
| 28 | headers_found.append(header) | 28 | headers_found.append(header) |
| 29 | 29 | ||
| 30 | - functions_defines = ( | ||
| 31 | - ('setsockopt', 'HAVE_SETSOCKOPT'), | ||
| 32 | - ('inet_ntoa', 'HAVE_INET_NTOA'), | ||
| 33 | - ('memset', 'HAVE_MEMSET'), | ||
| 34 | - ('select', 'HAVE_SELECT'), | ||
| 35 | - ('socket', 'HAVE_SOCKET')) | 30 | + functions_headers = ( |
| 31 | + ('setsockopt', 'sys/socket.h'), | ||
| 32 | + ('inet_ntoa', 'arpa/inet.h'), | ||
| 33 | + ('memset', 'string.h'), | ||
| 34 | + ('select', 'sys/select.h'), | ||
| 35 | + ('socket', 'sys/socket.h'), | ||
| 36 | + ) | ||
| 36 | 37 | ||
| 37 | - for (function, define) in functions_defines: | ||
| 38 | - e = conf.create_function_enumerator() | ||
| 39 | - e.mandatory = True | ||
| 40 | - e.function = function | ||
| 41 | - e.headers = headers_found | ||
| 42 | - e.define = define | ||
| 43 | - e.run() | 38 | + for (function, headers) in functions_headers: |
| 39 | + conf.check_cc(function_name=function, header_name=headers, mandatory=1) | ||
| 44 | 40 | ||
| 45 | conf.define('VERSION', VERSION) | 41 | conf.define('VERSION', VERSION) |
| 46 | conf.define('PACKAGE', 'libmodbus') | 42 | conf.define('PACKAGE', 'libmodbus') |
| @@ -50,18 +46,19 @@ def configure(conf): | @@ -50,18 +46,19 @@ def configure(conf): | ||
| 50 | def build(bld): | 46 | def build(bld): |
| 51 | import misc | 47 | import misc |
| 52 | 48 | ||
| 53 | - bld.add_subdirs('modbus tests') | 49 | + bld.add_subdirs('src tests') |
| 54 | 50 | ||
| 55 | - obj = bld.create_obj('subst') | ||
| 56 | - obj.source = 'modbus.pc.in' | ||
| 57 | - obj.target = 'modbus.pc' | ||
| 58 | - obj.dict = {'VERSION' : VERSION, | ||
| 59 | - 'prefix': bld.env()['PREFIX'], | ||
| 60 | - 'exec_prefix': bld.env()['PREFIX'], | ||
| 61 | - 'libdir': bld.env()['PREFIX'] + 'lib', | ||
| 62 | - 'includedir': bld.env()['PREFIX'] + 'include'} | 51 | + obj = bld.new_task_gen(features='subst', |
| 52 | + source='modbus.pc.in', | ||
| 53 | + target='modbus.pc', | ||
| 54 | + dict = {'VERSION' : VERSION, | ||
| 55 | + 'prefix': bld.env['PREFIX'], | ||
| 56 | + 'exec_prefix': bld.env['PREFIX'], | ||
| 57 | + 'libdir': bld.env['PREFIX'] + 'lib', | ||
| 58 | + 'includedir': bld.env['PREFIX'] + 'include'} | ||
| 59 | + ) | ||
| 63 | 60 | ||
| 64 | - install_files('PREFIX', 'lib/pkgconfig', 'modbus.pc') | 61 | + bld.install_files('${PREFIX}/lib/pkgconfig', 'modbus.pc') |
| 65 | 62 | ||
| 66 | def shutdown(): | 63 | def shutdown(): |
| 67 | import UnitTest | 64 | import UnitTest |