From: Olivier Gay Date: Sun, 27 Oct 2013 14:19:29 +0000 (+0100) Subject: Fix build issues with MinGW X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=5851dee3cd95d7b0276caa22b9d2992c8b1147fa;p=fw%2Fstlink Fix build issues with MinGW Remove st-term from the list of the targets for MinGW. st-term uses termios and would require a rewrite to have it compile on MinGW. Also remove cleanup signal handlers in gdb-server for MinGW to compile. --- diff --git a/Makefile.am b/Makefile.am index ab3201f..2ddbf47 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,7 +4,11 @@ SUBDIRS = . $(MAYBE_GUI) AUTOMAKE_OPTIONS = subdir-objects +if MINGW +bin_PROGRAMS = st-flash st-util st-info +else bin_PROGRAMS = st-flash st-util st-term st-info +endif noinst_LIBRARIES = libstlink.a @@ -18,9 +22,12 @@ CFILES = \ src/stlink-usb.c \ src/stlink-sg.c \ src/uglylogging.c \ - src/st-term.c \ src/st-info.c +if !MINGW +CFILES += src/st-term.c +endif + HFILES = \ src/stlink-common.h \ src/stlink-usb.h \ diff --git a/configure.ac b/configure.ac index 53f8278..f1357b1 100644 --- a/configure.ac +++ b/configure.ac @@ -32,7 +32,11 @@ case "${host}" in *-mingw32*) LIBS="$LIBS -lws2_32" CPPFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $CPPFLAGS" + AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system]) + AM_CONDITIONAL(MINGW, true) ;; + *) + AM_CONDITIONAL(MINGW, false) esac MAYBE_GUI= diff --git a/gdbserver/gdb-server.c b/gdbserver/gdb-server.c index bf14781..a6de1b2 100644 --- a/gdbserver/gdb-server.c +++ b/gdbserver/gdb-server.c @@ -57,6 +57,7 @@ typedef struct _st_state_t { int serve(stlink_t *sl, st_state_t *st); char* make_memory_map(stlink_t *sl); +#ifndef __MINGW32__ static void cleanup(int signal __attribute__((unused))) { if (connected_stlink) { /* Switch back to mass storage mode before closing. */ @@ -67,6 +68,7 @@ static void cleanup(int signal __attribute__((unused))) { exit(1); } +#endif @@ -196,8 +198,10 @@ int main(int argc, char** argv) { } connected_stlink = sl; +#ifndef __MINGW32__ signal(SIGINT, &cleanup); signal(SIGTERM, &cleanup); +#endif if (state.reset) { stlink_reset(sl);