Re: [code] Makefile cleanup... suggestions

From: Pedro Andres Aranda Gutierrez <paaguti.att.gmail.com>
Date: Tue, 20 Feb 2018 07:44:38 +0100

Hi Mitchell,

this is a step in the right direction for FreeBSD.

After applying this patch:

diff -r 198df90ca9c0 src/textadept.c
--- a/src/textadept.c Mon Feb 19 15:37:54 2018 -0500
+++ b/src/textadept.c Tue Feb 20 07:36:29 2018 +0100
@@ -17,7 +17,7 @@
 #elif __APPLE__
 #include <mach-o/dyld.h>
 #elif (__FreeBSD__ || __NetBSD__ || __OpenBSD__)
-#define u_int unsigned int // 'u_int' undefined when _POSIX_SOURCE is
defined
+typedef unsigned int u_int; // 'u_int' undefined when _POSIX_SOURCE is
defined
 #include <sys/types.h>
 #include <sys/sysctl.h>
 #endif

Compilation seems to go better, once you get rid of the -D POSIX... in the
textadept-curses target.

BEFORE

cc -c -Os -DLUA_USE_LINUX -Ilua/src -std=c99 -pedantic
-D_POSIX_C_SOURCE=200809L -D_DARWIN_C_SOURCE -DCURSES -Iscintilla/include
-Igtdialog -W -Wall -Wno-unused -Iscintilla/term -Itermkey -Icdk
-I/usr/local/include -I/usr/local/include/ncurses textadept.c -o
textadept-curses.o
textadept.c:356:47: warning: unused parameter '_' [-Wunused-parameter]
static void f_clicked(FindButton button, void*_) {
                                              ^
textadept.c:373:34: warning: unused parameter 'L' [-Wunused-parameter]
static int lfind_next(lua_State *L) {return (f_clicked(fnext_button, NULL),
0);}
                                 ^
textadept.c:376:34: warning: unused parameter 'L' [-Wunused-parameter]
static int lfind_prev(lua_State *L) {return (f_clicked(fprev_button, NULL),
0);}
                                 ^
textadept.c:386:39: warning: unused parameter '_' [-Wunused-parameter]
static int entry_keypress(EObjectType _, void *object, void *data, chtype
key) {
                                      ^
textadept.c:442:35: warning: unused parameter 'L' [-Wunused-parameter]
static int lfind_focus(lua_State *L) {
                                  ^
textadept.c:511:37: warning: unused parameter 'L' [-Wunused-parameter]
static int lfind_replace(lua_State *L) {return (f_clicked(r_button, NULL),
0);}
                                    ^
textadept.c:514:41: warning: unused parameter 'L' [-Wunused-parameter]
static int lfind_replace_all(lua_State *L) {
                                        ^
textadept.c:587:33: warning: unused parameter 'L' [-Wunused-parameter]
static int lce_focus(lua_State *L) {
                                ^
textadept.c:1387:29: warning: unused parameter 'L' [-Wunused-parameter]
static int lquit(lua_State *L) {
                            ^
textadept.c:1936:43: warning: unused parameter '_' [-Wunused-parameter]
static void s_notify(Scintilla *view, int _, void *lParam, void*__) {
                                          ^
textadept.c:1936:65: warning: unused parameter '__' [-Wunused-parameter]
static void s_notify(Scintilla *view, int _, void *lParam, void*__) {
                                                                ^
textadept.c:2554:13: error: use of undeclared identifier 'SIGWINCH'
  sigaction(SIGWINCH, &act, NULL);
            ^
textadept.c:2588:7: warning: implicit declaration of function
'gettimeofday' is invalid in C99
      [-Wimplicit-function-declaration]
      gettimeofday(&time, NULL);
      ^
12 warnings and 1 error generated.
gmake: *** [Makefile:186: textadept-curses.o] Error 1
gmake: se sale del directorio '/usr/home/paag/Devel/textadept/src'

AFTER removing the -D POSIX...

[paag.att.asus ~/Devel/textadept/src]$ cc -c -Os -DLUA_USE_LINUX -Ilua/src
-std=c99 -pedantic -D_DARWIN_C_SOURCE -DCURSES -Iscintilla/include
-Igtdialog -W -Wall -Wno-unused -Iscintilla/term -Itermkey -Icdk
-I/usr/local/include -I/usr/local/include/ncurses textadept.c -o
textadept-curses.o
textadept.c:356:47: warning: unused parameter '_' [-Wunused-parameter]
static void f_clicked(FindButton button, void*_) {
                                              ^
textadept.c:373:34: warning: unused parameter 'L' [-Wunused-parameter]
static int lfind_next(lua_State *L) {return (f_clicked(fnext_button, NULL),
0);}
                                 ^
textadept.c:376:34: warning: unused parameter 'L' [-Wunused-parameter]
static int lfind_prev(lua_State *L) {return (f_clicked(fprev_button, NULL),
0);}
                                 ^
textadept.c:386:39: warning: unused parameter '_' [-Wunused-parameter]
static int entry_keypress(EObjectType _, void *object, void *data, chtype
key) {
                                      ^
textadept.c:442:35: warning: unused parameter 'L' [-Wunused-parameter]
static int lfind_focus(lua_State *L) {
                                  ^
textadept.c:511:37: warning: unused parameter 'L' [-Wunused-parameter]
static int lfind_replace(lua_State *L) {return (f_clicked(r_button, NULL),
0);}
                                    ^
textadept.c:514:41: warning: unused parameter 'L' [-Wunused-parameter]
static int lfind_replace_all(lua_State *L) {
                                        ^
textadept.c:587:33: warning: unused parameter 'L' [-Wunused-parameter]
static int lce_focus(lua_State *L) {
                                ^
textadept.c:1387:29: warning: unused parameter 'L' [-Wunused-parameter]
static int lquit(lua_State *L) {
                            ^
textadept.c:1936:43: warning: unused parameter '_' [-Wunused-parameter]
static void s_notify(Scintilla *view, int _, void *lParam, void*__) {
                                          ^
textadept.c:1936:65: warning: unused parameter '__' [-Wunused-parameter]
static void s_notify(Scintilla *view, int _, void *lParam, void*__) {
                                                                ^
11 warnings generated.

After applying the patch and removing the -D POSIX... I get a working
textadept-curses in FreeBSD :-)
Need to go now, but will check on Linux later,

Best, /PA

On 20 February 2018 at 07:07, Pedro Andres Aranda Gutierrez <
paaguti.att.gmail.com> wrote:

> Hi,
>
> thx a lot. Will check and let u know
>
> /PA
>
> Enviado desde mi iPhone
>
> > El 19 feb 2018, a las 21:41, Mitchell <m.att.foicica.com> escribió:
> >
> > Hi Pedro,
> >
> >> On Sun, 4 Feb 2018, Pedro Andres Aranda Gutierrez wrote:
> >>
> >> Hi Mitchell
> >>
> >> As you know I've been trying to compile the curses version in FreeBSD.
> >> This has made me go through the compilation flags and I have seen some
> flags
> >> that seem to stem from older versions of the curses library. It would be
> >> good to
> >> know why the different flags are there. Those that are related with
> curses
> >> should
> >> not be there explicitly, but obtained through "pkg-config --cflags
> curses"
> >> The same applies to the linker flags.
> >>
> >> As a matter of fact, I'm using a construct in other Makefiles that
> allows me
> >> to compile programs with curses and ncurses:
> >>
> >> ifeq (1,$(shell pkg-config ncurses && echo 1))
> >> CFLAGS += pkg-config --cflags ncurses
> >> LDFLAGS += pkg-config --libs ncurses
> >> else
> >> CFLAGS += pkg-config --cflags curses
> >> LDFLAGS += pkg-config --libs curses
> >> endif
> >>
> >> Once that is sorted out, it would be good to continue with other
> libraries.
> >
> > I've committed something[1] that should help.
> >
> > Cheers,
> > Mitchell
> >
> > [1]: https://foicica.com/hg/textadept/rev/198df90ca9c0
> > --
> > You are subscribed to code.att.foicica.com.
> > To change subscription settings, send an e-mail to code+help.att.foicica.com
> .
> > To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
> >
>

-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellet zu werden
Georg Kreisler
-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Tue 20 Feb 2018 - 01:44:38 EST

This archive was generated by hypermail 2.2.0 : Tue 20 Feb 2018 - 06:28:46 EST