Fix historic make & cmake

This commit is contained in:
Philippe Teuwen 2020-06-14 21:25:20 +02:00
parent bcbef2edfc
commit 6adcfad752
9 changed files with 427 additions and 772 deletions

View file

@ -269,7 +269,7 @@ endif
CFLAGS ?= $(DEFCFLAGS)
# We cannot just use CFLAGS+=... because it has impact on sub-makes if CFLAGS is defined in env:
PM3CFLAGS = $(CFLAGS)
PM3CFLAGS += -I./src -I../include -I../common -I../common_fpga $(INCLUDES)
PM3CFLAGS += -I./src -I./include -I../include -I../common -I../common_fpga $(INCLUDES)
# WIP Testing
#PM3CFLAGS += -std=c11 -pedantic
@ -298,7 +298,7 @@ endif
CXXFLAGS ?= -Wall -Werror -O3
PM3CXXFLAGS = $(CXXFLAGS)
PM3CXXFLAGS += -I../include
PM3CXXFLAGS += -I../include -I./include
ifeq ($(QT_FOUND),1)
PM3CFLAGS += -DHAVE_GUI

View file

@ -111,6 +111,7 @@ set_property(TARGET pm3rrg_rdv4_hardnested PROPERTY POSITION_INDEPENDENT_CODE ON
target_include_directories(pm3rrg_rdv4_hardnested PRIVATE
../../common
../../include
../include
../src
jansson)
target_include_directories(pm3rrg_rdv4_hardnested INTERFACE hardnested)

View file

@ -1,5 +1,5 @@
MYSRCPATHS =
MYINCLUDES = -I../../../common -I../../../include -I../../src -I../jansson
MYINCLUDES = -I../../../common -I../../../include -I../../src -I../../include -I../jansson
MYCFLAGS =
MYDEFS =
MYSRCS = hardnested_bruteforce.c

View file

@ -5,7 +5,7 @@ typedef struct pm3_device pm3_device;
pm3_device* pm3_open(char *port);
int pm3_device_console(pm3_device* dev, char *cmd);
char *pm3_device_name_get(pm3_device* dev);
const char * pm3_device_name_get(pm3_device* dev);
void pm3_device_close(pm3_device* dev);
pm3_device* pm3_device_get_current_dev(void);
#endif // LIBPM3_H

View file

@ -3,6 +3,6 @@
int main(int argc, char *argv[]) {
pm3_device *p;
p = pm3_open("/dev/ttyACM0");
pm3_console(p, "hw status");
pm3_close(p);
pm3_device_console(p, "hw status");
pm3_device_close(p);
}

View file

@ -1,85 +1,24 @@
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.12
# Version 4.0.1
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swig_import_helper():
import importlib
pkg = __name__.rpartition('.')[0]
mname = '.'.join((pkg, '_pm3')).lstrip('.')
try:
return importlib.import_module(mname)
except ImportError:
return importlib.import_module('_pm3')
_pm3 = swig_import_helper()
del swig_import_helper
elif _swig_python_version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_pm3', [dirname(__file__)])
except ImportError:
import _pm3
return _pm3
try:
_mod = imp.load_module('_pm3', fp, pathname, description)
finally:
if fp is not None:
fp.close()
return _mod
_pm3 = swig_import_helper()
del swig_import_helper
if _swig_python_version_info < (2, 7, 0):
raise RuntimeError("Python 2.7 or later required")
# Import the low-level C/C++ module
if __package__ or "." in __name__:
from . import _pm3
else:
import _pm3
del _swig_python_version_info
try:
_swig_property = property
except NameError:
pass # Python < 2.2 doesn't have 'property'.
try:
import builtins as __builtin__
except ImportError:
import __builtin__
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"):
return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name, None)
if method:
return method(self, value)
if (not static):
if _newclass:
object.__setattr__(self, name, value)
else:
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr(self, class_type, name):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
@ -87,38 +26,55 @@ def _swig_repr(self):
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
try:
_object = object
_newclass = 1
except __builtin__.Exception:
class _object:
pass
_newclass = 0
class device(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, device, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, device, name)
def _swig_setattr_nondynamic_instance_variable(set):
def set_instance_attr(self, name, value):
if name == "thisown":
self.this.own(value)
elif name == "this":
set(self, name, value)
elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
set(self, name, value)
else:
raise AttributeError("You cannot add instance attributes to %s" % self)
return set_instance_attr
def _swig_setattr_nondynamic_class_variable(set):
def set_class_attr(cls, name, value):
if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
set(cls, name, value)
else:
raise AttributeError("You cannot add class attributes to %s" % cls)
return set_class_attr
def _swig_add_metaclass(metaclass):
"""Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
def wrapper(cls):
return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
return wrapper
class _SwigNonDynamicMeta(type):
"""Meta class to enforce nondynamic attributes (no new attributes) for a class"""
__setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)
class device(object):
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def __init__(self, *args):
this = _pm3.new_device(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
_pm3.device_swiginit(self, _pm3.new_device(*args))
__swig_destroy__ = _pm3.delete_device
__del__ = lambda self: None
def console(self, cmd):
return _pm3.device_console(self, cmd)
__swig_getmethods__["name"] = _pm3.device_name_get
if _newclass:
name = _swig_property(_pm3.device_name_get)
device_swigregister = _pm3.device_swigregister
device_swigregister(device)
name = property(_pm3.device_name_get)
# Register device in _pm3:
_pm3.device_swigregister(device)
# This file is compatible with both classic and new-style classes.

View file

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.12
* Version 4.0.1
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@ -185,6 +185,7 @@
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
#define SWIG_CAST_NEW_MEMORY 0x2
#define SWIG_POINTER_NO_NULL 0x4
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
@ -713,6 +714,23 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
}
#endif
/* Errors in SWIG */
#define SWIG_UnknownError -1
#define SWIG_IOError -2
#define SWIG_RuntimeError -3
#define SWIG_IndexError -4
#define SWIG_TypeError -5
#define SWIG_DivisionByZero -6
#define SWIG_OverflowError -7
#define SWIG_SyntaxError -8
#define SWIG_ValueError -9
#define SWIG_SystemError -10
#define SWIG_AttributeError -11
#define SWIG_MemoryError -12
#define SWIG_NullReferenceError -13
/* -----------------------------------------------------------------------------
* luarun.swg
*
@ -895,8 +913,8 @@ typedef struct swig_elua_entry {
* -------------------------------------------------------------------------- */
/* Push the string STR on the Lua stack, like lua_pushstring, but
prefixed with the the location of the innermost Lua call-point
(as formated by luaL_where). */
prefixed with the location of the innermost Lua call-point
(as formatted by luaL_where). */
SWIGRUNTIME void
SWIG_Lua_pusherrstring (lua_State *L, const char *str)
{
@ -906,8 +924,8 @@ SWIG_Lua_pusherrstring (lua_State *L, const char *str)
}
/* Push a formatted string generated from FMT and following args on
the Lua stack, like lua_pushfstring, but prefixed with the the
location of the innermost Lua call-point (as formated by luaL_where). */
the Lua stack, like lua_pushfstring, but prefixed with the
location of the innermost Lua call-point (as formatted by luaL_where). */
SWIGRUNTIME void
SWIG_Lua_pushferrstring (lua_State *L, const char *fmt, ...)
{
@ -1004,7 +1022,7 @@ to tell the two structures apart within SWIG, other than by looking at the type
typedef struct {
swig_type_info *type;
int own; /* 1 if owned & must be destroyed */
char data[1]; /* arbitary amount of data */
char data[1]; /* arbitrary amount of data */
} swig_lua_rawdata;
/* Common SWIG API */
@ -1056,7 +1074,7 @@ typedef struct {
#define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I))
#ifdef __cplusplus
/* Special helper for member function pointers
/* Special helper for member function pointers
it gets the address, casts it, then dereferences it */
/*#define SWIG_mem_fn_as_voidptr(a) (*((char**)&(a))) */
#endif
@ -1159,7 +1177,7 @@ SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_ent
lua_pop(L,1); /*remove nil */
lua_newtable(L);
SWIG_Lua_elua_emulate_register(L,entry->value.value.table);
}
}
if(is_metatable) {
assert(lua_istable(L,-1));
lua_pushvalue(L,-1);
@ -1168,11 +1186,11 @@ SWIGINTERN void SWIG_Lua_elua_emulate_register(lua_State *L, const swig_elua_ent
break;
case LUA_TUSERDATA:
if(entry->value.value.userdata.member)
if(entry->value.value.userdata.member)
SWIG_NewMemberObj(L,entry->value.value.userdata.pvalue,
entry->value.value.userdata.lvalue,
*(entry->value.value.userdata.ptype));
else
else
SWIG_NewPointerObj(L,entry->value.value.userdata.pvalue,
*(entry->value.value.userdata.ptype),0);
break;
@ -1217,7 +1235,7 @@ SWIGINTERN int SWIG_Lua_emulate_elua_getmetatable(lua_State *L)
}
assert(lua_gettop(L) == 2);
return 1;
fail:
lua_error(L);
return 0;
@ -1235,7 +1253,7 @@ SWIGINTERN void SWIG_Lua_emulate_elua_swap_getmetatable(lua_State *L)
lua_pushcfunction(L, SWIG_Lua_emulate_elua_getmetatable);
lua_rawset(L,-3);
lua_pop(L,2);
}
/* END OF REMOVE */
@ -1754,17 +1772,11 @@ SWIGINTERN int SWIG_Lua_class_tostring(lua_State *L)
{
/* there should be 1 param passed in
(1) userdata (not the metatable) */
const char *className;
void* userData;
swig_lua_userdata* userData;
assert(lua_isuserdata(L,1)); /* just in case */
userData = lua_touserdata(L,1); /* get the userdata address for later */
lua_getmetatable(L,1); /* get the meta table */
assert(lua_istable(L,-1)); /* just in case */
userData = (swig_lua_userdata*)lua_touserdata(L,1); /* get the userdata address */
lua_getfield(L, -1, ".type");
className = lua_tostring(L, -1);
lua_pushfstring(L, "<%s userdata: %p>", className, userData);
lua_pushfstring(L, "<userdata of type '%s' at %p>", userData->type->str, userData->ptr);
return 1;
}
@ -1776,7 +1788,7 @@ SWIGINTERN int SWIG_Lua_class_disown(lua_State *L)
swig_lua_userdata *usr;
assert(lua_isuserdata(L,-1)); /* just in case */
usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */
usr->own = 0; /* clear our ownership */
return 0;
}
@ -1885,7 +1897,7 @@ SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State *L,const char *cname)
Each class structure has a list of pointers to the base class structures.
This function fills them.
It cannot be done at compile time, as this will not work with hireachies
spread over more than one swig file.
spread over more than one swig file.
Therefore it must be done at runtime, querying the SWIG type system.
*/
SWIGINTERN void SWIG_Lua_init_base_class(lua_State *L,swig_lua_class *clss)
@ -2119,11 +2131,11 @@ SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L)
lua_checkstack(L,5);
numargs = lua_gettop(L); /* number of arguments to pass to actual metamethod */
/* Get upvalues from closure */
lua_pushvalue(L, lua_upvalueindex(1)); /*Get function name*/
metamethod_name_idx = lua_gettop(L);
lua_pushvalue(L, lua_upvalueindex(2));
clss = (const swig_lua_class*)(lua_touserdata(L,-1));
lua_pop(L,1); /* remove lightuserdata with clss from stack */
@ -2155,7 +2167,7 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *
/* metamethod name - on the top of the stack */
assert(lua_isstring(L,-1));
key_index = lua_gettop(L);
/* Check whether method is already defined in metatable */
@ -2165,7 +2177,7 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *
lua_pop(L,1);
return -1;
}
lua_pop(L,1);
lua_pop(L,1);
/* Iterating over immediate bases */
for(i=0;clss->bases[i];i++)
@ -2175,13 +2187,13 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *
lua_pushvalue(L, key_index);
lua_rawget(L, -2);
if( !lua_isnil(L,-1) ) {
lua_pushvalue(L, key_index);
lua_pushvalue(L, key_index);
/* Add proxy function */
lua_pushvalue(L, key_index); /* first closure value is function name */
lua_pushlightuserdata(L, clss); /* second closure value is swig_lua_class structure */
lua_pushcclosure(L, SWIG_Lua_resolve_metamethod, 2);
lua_rawset(L, metatable_index);
success = 1;
}
@ -2192,7 +2204,7 @@ SWIGINTERN int SWIG_Lua_add_class_user_metamethod(lua_State *L, swig_lua_class *
break;
}
return success;
return success;
}
SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class *clss)
@ -2480,7 +2492,12 @@ SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State *L,int index,void **ptr,swig_type
{
swig_lua_userdata *usr;
swig_cast_info *cast;
if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;} /* special case: lua nil => NULL pointer */
/* special case: lua nil => NULL pointer */
if (lua_isnil(L,index))
{
*ptr=0;
return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
}
usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */
if (usr)
{
@ -2526,7 +2543,7 @@ SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State *L,void *ptr,size_t size,swig_t
memcpy(raw->data,ptr,size); /* copy the data */
SWIG_Lua_AddMetatable(L,type); /* add metatable */
}
/* converts a packed userdata. user for member fn pointers only */
SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State *L,int index,void *ptr,size_t size,swig_type_info *type)
{
@ -2575,7 +2592,7 @@ SWIG_Lua_InstallConstants(lua_State *L, swig_lua_const_info constants[]) {
switch(constants[i].type) {
case SWIG_LUA_INT:
lua_pushstring(L,constants[i].name);
lua_pushinteger(L,(lua_Number)constants[i].lvalue);
lua_pushinteger(L,(lua_Integer)constants[i].lvalue);
lua_rawset(L,-3);
break;
case SWIG_LUA_FLOAT:
@ -2586,7 +2603,7 @@ SWIG_Lua_InstallConstants(lua_State *L, swig_lua_const_info constants[]) {
case SWIG_LUA_CHAR:
lua_pushstring(L,constants[i].name);
{
char c = constants[i].lvalue;
char c = (char)constants[i].lvalue;
lua_pushlstring(L,&c,1);
}
lua_rawset(L,-3);
@ -2625,7 +2642,7 @@ Unfortunately lua keeps changing its APIs, so we need a conditional compile
In lua 5.0.X it's lua_dostring()
In lua 5.1.X it's luaL_dostring()
*/
SWIGINTERN int
SWIGINTERN int
SWIG_Lua_dostring(lua_State *L, const char *str) {
int ok,top;
if (str==0 || str[0]==0) return 0; /* nothing to do */
@ -2640,7 +2657,7 @@ SWIG_Lua_dostring(lua_State *L, const char *str) {
}
lua_settop(L,top); /* restore the stack */
return ok;
}
}
#ifdef __cplusplus
}
@ -2686,7 +2703,7 @@ SWIGINTERN int SWIG_lua_isnilstring(lua_State *L, int idx) {
SWIGINTERN pm3_device *new_pm3_device__SWIG_1(char *port){
printf("SWIG pm3_device constructor with port, open pm3\n");
pm3_device * p = pm3_open(port);
p->script_embedded = 1;
p->script_embedded = 0;
return p;
}
SWIGINTERN void delete_pm3_device(pm3_device *self){
@ -3011,7 +3028,7 @@ SWIG_InitializeModule(void *clientdata) {
/* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: size %d\n", swig_module.size);
printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size);
#endif
for (i = 0; i < swig_module.size; ++i) {
swig_type_info *type = 0;
@ -3019,7 +3036,7 @@ SWIG_InitializeModule(void *clientdata) {
swig_cast_info *cast;
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
#endif
/* if there is another module already loaded */
@ -3095,7 +3112,7 @@ SWIG_InitializeModule(void *clientdata) {
for (i = 0; i < swig_module.size; ++i) {
int j = 0;
swig_cast_info *cast = swig_module.cast_initial[i];
printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
while (cast->type) {
printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
cast++;

File diff suppressed because it is too large Load diff

View file

@ -14,6 +14,7 @@
#include <unistd.h>
#include "common.h"
#include "pm3.h"
#define PROXPROMPT_MAX_SIZE 255
@ -51,13 +52,6 @@ const char *get_my_executable_directory(void);
const char *get_my_user_directory(void);
void main_loop(char *script_cmds_file, char *script_cmd, bool stayInCommandLoop);
typedef struct pm3_device pm3_device;
pm3_device* pm3_open(char *port);
int pm3_console(pm3_device* dev, char *cmd);
char *pm3_get_name(pm3_device* dev);
void pm3_close(pm3_device* dev);
pm3_device* pm3_get_current_dev(void);
#ifdef __cplusplus
}
#endif