profile.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // Copyright (c) 2013-2014, Alberto Corona <alberto@0x1a.us>
  2. // All rights reserved. This file is part of yabs, distributed under the BSD
  3. // 3-Clause license. For full terms please see the LICENSE file.
  4. #ifndef _PROFILE_H
  5. #define _PROFILE_H
  6. #include <stdlib.h>
  7. #include <string>
  8. #include <vector>
  9. #include "gen.h"
  10. #define MAX_OPT 20
  11. class Profile : public Generate
  12. {
  13. private:
  14. FILE *inc_conf;
  15. FILE *Makefile;
  16. std::string os;
  17. std::string lang;
  18. std::string target;
  19. std::string cc;
  20. std::string cxx;
  21. std::string dist;
  22. std::string include;
  23. std::string remote;
  24. std::string defines;
  25. std::string version;
  26. std::vector<std::string> arch;
  27. std::vector<std::string> cxxflags;
  28. std::vector<std::string> libs;
  29. std::vector<std::string> incdir;
  30. std::vector<std::string> libdir;
  31. std::vector<std::string> clean;
  32. std::vector<std::string> lflags;
  33. std::vector<std::string> before;
  34. std::vector<std::string> after;
  35. std::vector<std::string> obj;
  36. std::string plat;
  37. std::string p_arch;
  38. std::string STDValues[MAX_OPT] = {
  39. "os", "arch", "cc", "cxx", "cflags",
  40. "cxxflags", "lflags", "include", "lang", "dist",
  41. "before-script", "after-script", "libs", "libdir", "incdir",
  42. "target", "remote", "clean", "defines", "version",
  43. };
  44. std::string temp;
  45. public:
  46. Profile();
  47. int CompValid(unsigned char *comp_value);
  48. int RegValues(const char *reg_value);
  49. int WriteMake(const char *makefile);
  50. int Build();
  51. std::string ConvValue(unsigned char *conv_value);
  52. std::string PrependLink(std::string &to_pre, std::string pre);
  53. std::string GetOS() const;
  54. void OpenInclude(const std::string file);
  55. void PopValidValue(std::string &k_value, std::string v_value);
  56. void PrintList(const std::vector<std::string> vect) const;
  57. void WriteListToMake(std::vector<std::string> &vect,
  58. std::string out_name);
  59. std::string VectToString(std::vector<std::string> &to_swap);
  60. void WriteSwapValues(const std::string &val, std::string out_name);
  61. void PrintProfile() const;
  62. void CheckBlankValues();
  63. void GetSysInfo();
  64. void CheckLang();
  65. void BuildObjList();
  66. };
  67. #endif