dolib.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2020 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. /* Wrapper to avoid msys' tendency to turn / into \ and : into ; */
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
  20. #include <unistd.h>
  21. #endif
  22. int main(int argc, char *argv[])
  23. {
  24. char *prog, *arch, *def, *effective_version, *version, *lib;
  25. char s[1024];
  26. char name[16];
  27. int current, age, revision;
  28. if (argc != 7)
  29. {
  30. fprintf(stderr,"bad number of arguments");
  31. exit(EXIT_FAILURE);
  32. }
  33. prog = argv[1];
  34. arch = argv[2];
  35. def = argv[3];
  36. effective_version = argv[4];
  37. version = argv[5];
  38. lib = argv[6];
  39. if (sscanf(version, "%d:%d:%d", &current, &revision, &age) != 3)
  40. exit(EXIT_FAILURE);
  41. _snprintf(name, sizeof(name), "libstarpu-%s-%d", effective_version, current - age);
  42. printf("using soname %s\n", name);
  43. _snprintf(s, sizeof(s), "\"%s\" /machine:%s /def:%s /name:%s /out:%s",
  44. prog, arch, def, name, lib);
  45. if (system(s))
  46. {
  47. fprintf(stderr, "%s failed\n", s);
  48. exit(EXIT_FAILURE);
  49. }
  50. exit(EXIT_SUCCESS);
  51. }