Skip to content

Commit

Permalink
Añadiendo script para obtener el .o con la información de las estruct…
Browse files Browse the repository at this point in the history
…uras de worm

añadiendo obj/ al gitignore
Cambio de nombre a Makefile
  • Loading branch information
Rafael Leira Osuna committed Jan 22, 2016
1 parent 7855eaf commit a6792df
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 35 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*.ko
*.obj
*.elf
obj/

*.orig

Expand Down Expand Up @@ -146,4 +147,4 @@ target/
GPATH
GRTAGS
GTAGS
GSYMS
GSYMS
43 changes: 43 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
export CC=gcc
export CXX=g++
export FLAGS=-I include/ -Wall -Werror
export CFLAGS=$(FLAGS) -std=c99 -fPIC
export CXXFLAGS=$(FLAGS) -std=c++11
export LDFLAGS=-fPIC

INCLUDES := $(wildcard include/*.h include/*.hpp)


all: einstein libs

einstein: obj/einstein.o

lib/libworm.so: obj/worm.o obj/common.o obj/structures.h.o
$(CC) $(CFLAGS) -shared -o $@ $^ $(LDFLAGS)

obj:
mkdir -p obj

libs: lib lib/libworm.so

lib:
mkdir -p lib

buildTools:
$(MAKE) -C tools

obj/%.o: src/%.cpp obj $(INCLUDES)
$(CXX) $(CXXFLAGS) -c $< -o $@

obj/%.o: src/%.c obj $(INCLUDES)
$(CC) $(CFLAGS) -c $< -o $@


clean:
rm -rf obj lib


#Custom Data .o
obj/structures.h.o: $(INCLUDES)
./tools/parseFile.bash > obj/structures.h
objcopy --input binary --output elf64-x86-64 --binary-architecture i386 obj/structures.h $@
19 changes: 19 additions & 0 deletions include/worm_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,31 @@ extern "C" {
*/
uint8_t WH_DymRoute_init (const uint8_t * const routeDescription, DestinationWorms** cns);


/* Name WH_DymRoute_init
* Starts the Dynamic Routing Library, and setups connection configuration.
* Also makes connections
* Return 0 if OK, something else if error.
*/
uint8_t WH_DymRoute_route_create (FILE* f, const uint8_t * const routeDescription, DestinationWorms** cns);
/* Name WH_DymRoute_init
* Starts the Dynamic Routing Library, and setups connection configuration.
* Also makes connections
* Return 0 if OK, something else if error.
*/
uint8_t WH_DymRoute_route_createFunc (FILE* f, const uint8_t * const routeDescription, DestinationWorms** cns);

/* Name WH_DymRoute_route
* Enrute a message
* Return the number of msgs sent
*/
uint8_t WH_DymRoute_route (const MessageInfo * const mi, DestinationWorms* const cns);

/* Name WH_DymRoute_precompiled_route
* Enrute a message
* Return the number of msgs sent
*/
uint8_t (*WH_DymRoute_precompiled_route) (const MessageInfo * const mi, DestinationWorms* const cns);

/* Name WH_DymRoute_send
* Sends a message to the network
Expand Down
34 changes: 0 additions & 34 deletions makefile

This file was deleted.

4 changes: 4 additions & 0 deletions tools/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
all:

clean:
#rm -rf
9 changes: 9 additions & 0 deletions tools/cStructureExtract.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <stdio.h>


int main()
{


return 0;
}
33 changes: 33 additions & 0 deletions tools/parseFile.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

FILES=$(ls include/*.h)


for f in $FILES
do
flag=0

cat $f | while read in
do

if [[ flag -eq 0 ]]
then

if [[ $in == *"struct"* || $in == *"enum"* ]]
then
echo "${in}"
flag=1
fi
else
echo "${in}"
fi


if [[ $in == *"}"* ]]
then
flag=0
fi

done

done

0 comments on commit a6792df

Please sign in to comment.