:: Re: [DNG] Pointer error in the back…
Top Pagina
Delete this message
Reply to this message
Auteur: Edward Bartolo
Datum:  
Aan: Rainer Weikusat
CC: dng
Onderwerp: Re: [DNG] Pointer error in the backend of Netman
Hi Rainer,

Edited Makefile as you instructed me. Now, using "make -C ." in
netman/ directory creates two executables: netman (GUI frontend) and
backend (CLI backend).

Please ignore the "Sender" parameter not used warnings. It is normal
not to use Sender although there are instances where it is useful.
There are other warnings regarding variables not being initialised.
Sometimes it doesn't make sense to initialise a variable if the
initial value will always be overwritten.

Edward

On 07/12/2015, Rainer Weikusat <rainerweikusat@???> wrote:
> Edward Bartolo <edbarx@???> writes:
>> Hi Rainer,
>>
>> This is Makefile from netman:
>>
>> ---------------------------------------------------
>> all: backend netman
>>
>> backend:
>>         make -C backend_src
>>         cp backend_src/bin/backend .

>>
>> netman: netman.lpr
>>         lazbuild -B netman.lpr | awk '/./{print $$0}'

>>
>> clean:
>>         make -C backend_src clean
>>         rm -f lib/*/*.*
>>         rm -f backend netman

>>
>> .PHONY: all clean
>> ---------------------------------
>>
>> Please tell me what I should change.
>
> The issues are with the backend_src Makefile which looks like this:
>
> ----------------
> # Makefile for cli_backend
>
> CC=gcc
>
> OBJECTS=\
>         obj/backend.o \
>         obj/caller.o \
>         obj/core_functions.o \
>         obj/file_functions.o \
>         obj/essid_encoder.o

>
> CFLAGS += -Wall -Wextra -Iinclude -g -O2
> #CFLAGS += -Wall -Wextra -Iinclude -ggdb
>
> all: $(OBJECTS) bin/backend
>
> clean:
>         rm -f $(OBJECTS) bin/backend

>
> bin/backend: $(OBJECTS)
>         $(CC) -o $@ $(OBJECTS)

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

>
> -----------------
>
> Problems with this: OBJECTS doesn't contain automated_scanner.o, leading
> to a link failure and the linker command (bin/backend target) is missing
> a -lm in order to link with the math library (for the pow
> function). Further, the obj and bin directories don't exist.
>
> Below is a git-created patch addressing all this (using Timo Burmester's
> idea of creating the directories via Makefile as that's less manual
> work):
>
> -----------------
> diff --git a/backend_src/Makefile b/backend_src/Makefile
> index 0b48a1d..ffcaa52 100644
> --- a/backend_src/Makefile
> +++ b/backend_src/Makefile
> @@ -7,7 +7,8 @@ OBJECTS=\
>      obj/caller.o \
>      obj/core_functions.o \
>      obj/file_functions.o \
> -    obj/essid_encoder.o
> +    obj/essid_encoder.o \
> +    obj/automated_scanner.o

>
>  CFLAGS += -Wall -Wextra -Iinclude -g -O2
>  #CFLAGS += -Wall -Wextra -Iinclude -ggdb
> @@ -17,9 +18,11 @@ all: $(OBJECTS) bin/backend
>  clean:
>      rm -f $(OBJECTS) bin/backend

>
> -bin/backend: $(OBJECTS)
> -    $(CC) -o $@ $(OBJECTS)
> +bin/backend: $(OBJECTS) bin
> +    $(CC) -o $@ $(OBJECTS) -lm

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

>
> +bin obj:
> +    mkdir $@
> -------------------

>
> In order to apply this, save it to a file, say, /tmp/nm.diff. Go to the
> top-level netman directory and run
>
> patch -p1 </tmp/nm.diff
>
> And check the modified backen_src/Makefile into git with some commit
> message of your liking.
>
> NB: The patch is a bit overkill here but as the procedure is pretty much
> standard for communicating changes to some source tree, I thought you'd
> be interested in it.
> _______________________________________________
> Dng mailing list
> Dng@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
>