ymake.core.conf 226 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697
  1. # !!! DISCLAIMER! PLEASE DON'T IGNORE !!!
  2. # The FAKEID value is huge hammer. It affects UIDs of all nodes in build graph including, but not limited to
  3. # any resource fetch (think java contrib), build on any language (C++, Python, Java, Go), any code generation.
  4. # Any build after this change will pay the price:
  5. # - Local builds and Sandbox builds will reload all resources from Sandbox and cached data from YT (if ready).
  6. # - Distributed (YT) cache warmup will take significant time to catch up and will need to recache everything.
  7. # - Autocheck will rebuild and recache everything.
  8. # Use this with extreme care and only change if it is ultimately needed. Consider more specific XXX_FAKEIDs below instead.
  9. FAKEID=628318530716
  10. SANDBOX_FAKEID=${FAKEID}.7600000
  11. CPP_FAKEID=2023-11-01
  12. GO_FAKEID=11100371
  13. ANDROID_FAKEID=2023-05-17
  14. CLANG_TIDY_FAKEID=2023-06-06
  15. CYTHON_FAKE_ID=10784829
  16. JAVA_FAKEID=108490091
  17. PROTO_FAKEID=0
  18. FBS_FAKEID=2023-09-01
  19. # Change of this value will invalidate some parts of configure cache
  20. # but will not affect builds anyhow (except tests referring build/ directory)
  21. JSON_CACHE_FAKE_ID=11215402
  22. CURDIR=.
  23. MODDIR=.
  24. BINDIR=bin:/
  25. SRCDIR=
  26. YMAKE=ymake
  27. ECHO=echo
  28. INCLUDE_EXTS=.h .hh .hpp .rli .cuh .inc .i .ipp .ixx .ya_exposed
  29. CPP_EXT=.cpp
  30. OBJ_SUF=
  31. CFLAGS=
  32. EXTRA_C_FLAGS=
  33. SFLAGS=
  34. SRCFLAGS=
  35. FORCE_COVERAGE_ENABLED=
  36. FORCE_COVERAGE_DISABLED=
  37. AUTOCHECK_BALANCING_OPTIONS=
  38. SO_OUTPUTS=no
  39. MODULE_PREFIX=
  40. MODULE_SUFFIX=
  41. @import "${CONF_ROOT}/conf/settings.conf"
  42. @import "${CONF_ROOT}/conf/opensource.conf"
  43. @import "${CONF_ROOT}/conf/sysincl.conf"
  44. @import "${CONF_ROOT}/conf/license.conf"
  45. @import "${CONF_ROOT}/conf/docs.conf"
  46. @import "${CONF_ROOT}/conf/swig.conf"
  47. @import "${CONF_ROOT}/conf/proto.conf"
  48. @import "${CONF_ROOT}/conf/fbs.conf"
  49. @import "${CONF_ROOT}/conf/project_specific/other.conf"
  50. @import "${CONF_ROOT}/conf/project_specific/yt.conf"
  51. USE_GLOBAL_CMD=no
  52. when ($OS_WINDOWS != "yes") {
  53. USE_GLOBAL_CMD=yes
  54. }
  55. when ($USE_PYTHON) {
  56. C_DEFINES+= -DUSE_PYTHON
  57. }
  58. __COMMA__=${comma:""}
  59. ARCADIA_TEST_ROOT=../arcadia_tests_data/
  60. DEFAULT_REQUIREMENTS=network:restricted cpu:1 ram:32
  61. FAIL_PY2=no
  62. _PREBUILT_TOOLS_ROOT=build/prebuilt
  63. _TOOL_PROTOC_GEN_GO=vendor/github.com/golang/protobuf/protoc-gen-go
  64. _TOOL_PROTOC_GEN_GO_V2=vendor/google.golang.org/protobuf/cmd/protoc-gen-go
  65. _TOOL_PROTOC_GEN_GO_GRPC_V2=vendor/google.golang.org/grpc/cmd/protoc-gen-go-grpc
  66. _TOOL_RESCOMPILER=tools/rescompiler
  67. _TOOL_RESCOMPRESSOR=tools/rescompressor
  68. _TOOL_RORESCOMPILER=tools/rorescompiler
  69. when ($DISABLE_SEPARATE_AUX_CPP != "yes") {
  70. SEPARATE_AUX_CPP=yes
  71. }
  72. when ($USE_PREBUILT_TOOLS == "yes") {
  73. when ($HOST_ARCH_X86_64 == "yes" && $ARCH_X86_64 == "yes" && ($HOST_OS_LINUX == "yes" || $HOST_OS_WINDOWS == "yes")) {
  74. _TOOL_PROTOC_GEN_GO=${_PREBUILT_TOOLS_ROOT}/vendor/github.com/golang/protobuf/protoc-gen-go
  75. }
  76. when ($HOST_OS_DARWIN == "yes" && ($HOST_ARCH_ARM64 == "yes" || $HOST_ARCH_X86_64 == "yes")) {
  77. when ($ARCH_ARM64 == "yes" || $ARCH_X86_64 == "yes") {
  78. _TOOL_PROTOC_GEN_GO=${_PREBUILT_TOOLS_ROOT}/vendor/github.com/golang/protobuf/protoc-gen-go
  79. }
  80. }
  81. }
  82. FAIL_MODULE_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/fail_module_cmd.py"} $TARGET ${kv;hide:"p ER"} ${kv;hide:"pc red"}
  83. DEFAULT_TIDY_CONFIG=build/config/tests/clang_tidy/config.yaml
  84. PROJECT_TIDY_CONFIG=build/config/tests/clang_tidy/config.yaml
  85. TIDY=
  86. TIDY_ENABLED=
  87. when($TIDY == "yes") {
  88. TIDY_ENABLED=yes
  89. }
  90. when ($TIDY_ENABLED == "yes") {
  91. when ($TIDY_EXPORT_FIXES=="") {
  92. TIDY_EXPORT_FIXES="no"
  93. }
  94. CLANG_TIDY_ARGS=${hide:CLANG_TIDY_FAKEID} $YMAKE_PYTHON ${input:"build/scripts/clang_tidy.py"} "--ymake-python" $YMAKE_PYTHON "--clang-tidy-bin" "$(CLANG_TIDY_BIN)/bin/clang-tidy" "--config-validation-script" ${input:"build/tests/config/clang_tidy/tidy_config_validation.py"} "--testing-src" ${input:SRC} "--source-root" $(SOURCE_ROOT) "--build-root" $(BUILD_ROOT) "--tidy-json" ${output;noauto;suf=${COMPILE_OUT_SUFFIX}${OBJ_CROSS_SUF}.tidyjson:SRC} "--export-fixes" $TIDY_EXPORT_FIXES
  95. CLANG_TIDY_ARGS+="--default-config-file" ${input:DEFAULT_TIDY_CONFIG}
  96. CLANG_TIDY_ARGS+="--project-config-file" ${input:PROJECT_TIDY_CONFIG}
  97. when ($TIDY_CHECKS) {
  98. CLANG_TIDY_ARGS+="--checks=$TIDY_CHECKS"
  99. }
  100. when ($TIDY_HEADER_FILTER) {
  101. CLANG_TIDY_ARGS+="--header-filter=$TIDY_HEADER_FILTER"
  102. }
  103. TIDY_VALUE=USE_CONDITIONAL_SRCS
  104. }
  105. otherwise {
  106. CLANG_TIDY_ARGS=
  107. TIDY_VALUE=
  108. }
  109. # tag:profile
  110. NEED_PROFILE_RUNTIME=no
  111. when ($BUILD_TYPE == "PROFILE" || $BUILD_TYPE == "COVERAGE" || ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") || $GCOV_COVERAGE == "yes" || $PGO_ADD == "yes") {
  112. when($CLANG && ($TARGET_PLATFORM == "LINUX" || $TARGET_PLATFORM == "DARWIN")) {
  113. NEED_PROFILE_RUNTIME=yes
  114. }
  115. }
  116. otherwise {
  117. NEED_PROFILE_RUNTIME=no
  118. }
  119. when ($NEED_PROFILE_RUNTIME == "yes") {
  120. COPY_PROFILE_RUNTIME=\
  121. $YMAKE_PYTHON3 ${input:"build/scripts/copy_clang_profile_rt.py"} \
  122. --arch $TARGET_PLATFORM \
  123. --build-root $ARCADIA_BUILD_ROOT --
  124. COPY_PROFILE_RUNTIME+=\
  125. ${rootrel:PEERS} \
  126. $LDFLAGS
  127. }
  128. otherwise {
  129. COPY_PROFILE_RUNTIME=
  130. }
  131. # tag:codenav
  132. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  133. PY_PROGRAM_LINK_EXE=$LINK_EXE ${kv;hide:"pyndex $TARGET"}
  134. YNDEXER_ARGS=$YMAKE_PYTHON ${input:"build/scripts/yndexer.py"} $CPPYNDEXER_RESOURCE_GLOBAL/yndexer 1500 $(SOURCE_ROOT) $ARCADIA_BUILD_ROOT ${input:SRC}
  135. YNDEXER_OUTPUT=${output;noauto;suf=${OBJ_CROSS_SUF}${COMPILE_OUT_SUFFIX}.ydx.pb2:SRC}
  136. }
  137. otherwise {
  138. PY_PROGRAM_LINK_EXE=$LINK_EXE
  139. YNDEXER_ARGS=
  140. YNDEXER_OUTPUT=
  141. }
  142. when ($RETRY == "yes") {
  143. RETRY_ARGS=$YMAKE_PYTHON ${input:"build/scripts/wrapcc.py"}
  144. }
  145. otherwise {
  146. RETRY_ARGS=
  147. }
  148. COVERAGE_FLAGS=
  149. EXTRA_OUTPUT=
  150. when ($CLANG == "yes" || $GCC == "yes") {
  151. when ($BUILD_TYPE == "COVERAGE" || $GCOV_COVERAGE) {
  152. COVERAGE_FLAGS=-fprofile-arcs -ftest-coverage
  153. EXTRA_OUTPUT=${output;noauto;hide;suf=${COMPILE_OUT_SUFFIX}${_CROSS_SUFFIX}.gcno:SRC}
  154. }
  155. }
  156. when ($OS_CYGWIN == "yes") {
  157. CFLAGS+=-D_LDBL_EQ_DBL=1 -U__STRICT_ANSI__
  158. USE_ASMLIB=no
  159. FSTACK=
  160. }
  161. when ($OS_IOS == "yes" || $OS_ANDROID == "yes") {
  162. USE_ASMLIB=no
  163. }
  164. CFLAGS+=$COVERAGE_FLAGS
  165. LDFLAGS+=$COVERAGE_FLAGS
  166. CHECKFLAG=
  167. NO_MAPREDUCE=
  168. when ($NO_MAPREDUCE == "yes") {
  169. C_DEFINES+=-DNO_MAPREDUCE
  170. }
  171. when ($OS_ANDROID == "yes") {
  172. PIE=yes
  173. }
  174. when ($CLANG && $OS_DARWIN && $SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  175. SO_OUTPUTS=yes
  176. }
  177. when ($OS_NONE == "yes" || $MAPSMOBI_BUILD_TARGET == "yes" && $OS_LINUX != "yes") {
  178. USE_STL_SYSTEM=yes
  179. }
  180. # USE_INTERNAL_STL is an internal flag (set on by default) but may be used externally to
  181. # select system standard C++ library when USE_INTERNAL_STL=no is set.
  182. #
  183. # USE_STL_SYSTEM=yes is a regular way to select system standard C++ library.
  184. #
  185. when ($USE_STL_SYSTEM == "yes") {
  186. USE_INTERNAL_STL=no
  187. }
  188. when ($USE_INTERNAL_STL == "no") {
  189. USE_STL_SYSTEM=yes
  190. }
  191. otherwise {
  192. USE_INTERNAL_STL=yes
  193. # TODO: Extract to conf/sysincl.conf
  194. # This trigger doesn't work for module level since SYSINCL is processed at
  195. # configuration stage (This means that NO_RUNTIME() macro called in ya.make
  196. # won't affect SYSINCL and the only way to make this trigger work correctly
  197. # is to define configuration variable NORUNTIME (-DNORUNTIME) on the command
  198. # line when `ya make ...` is invoked.
  199. when ($NORUNTIME != "yes") {
  200. SYSINCL+=build/sysincl/stl-to-libcxx.yml
  201. SYSINCL+=build/sysincl/stl-to-libcxxmsvc.yml
  202. when ($MUSL == "yes") {
  203. SYSINCL+=build/sysincl/libc-musl-libcxx.yml
  204. }
  205. }
  206. }
  207. # tag:linux-specific
  208. when ($OS_LINUX && $OS_SDK == "ubuntu-14" && $MUSL != "yes") {
  209. USE_UBUNTU_COMPATIBILITY=yes
  210. }
  211. USE_ARCADIA_PYTHON=yes
  212. USE_ARCADIA_LIBM=no
  213. USE_EAT_MY_DATA=no
  214. HAVE_MKL=
  215. when ($HAVE_MKL == "") {
  216. when ($OS_LINUX && $ARCH_X86_64 && !$SANITIZER_TYPE) {
  217. HAVE_MKL=yes
  218. }
  219. otherwise {
  220. HAVE_MKL=no
  221. }
  222. }
  223. SFDL_TMP_OUT= ${output;tmp:SRC.tmp}
  224. # tag:tool-specific
  225. ARCH_TOOL=${tool:"tools/archiver"}
  226. # tag:tool-specific
  227. FML_TOOL=${tool:"tools/relev_fml_codegen"}
  228. FML_UNUSED_TOOL=${tool:"tools/relev_fml_unused"}
  229. LUA_TOOL=${tool:"tools/lua"}
  230. ENUM_PARSER_TOOL=${tool:"tools/enum_parser/enum_parser"}
  231. FATAL_ERROR_MODULE=no
  232. FATAL_ERROR_MESSAGE=
  233. ANTLR_PYTHON=Python2
  234. ### @usage: NO_LTO()
  235. ###
  236. ### Disable any lto (link-time optimizations) for the module.
  237. ### This will compile module source files as usual (without LTO) but will not prevent lto-enabled
  238. ### linking of entire program if global settings say so.
  239. macro NO_LTO() {
  240. DISABLE(USE_LTO)
  241. DISABLE(USE_THINLTO)
  242. }
  243. # tag:allocator
  244. DEFAULT_ALLOCATOR=LF
  245. # tag:allocator
  246. when ($OS_ANDROID == "yes" || $MSVC == "yes" || $ARCH_TYPE_32 == "yes" || $ARCH_AARCH64 == "yes") {
  247. DEFAULT_ALLOCATOR=J
  248. }
  249. # tag:allocator
  250. when ($OS_CYGWIN == "yes" || $ARCH_PPC64LE == "yes") {
  251. DEFAULT_ALLOCATOR=SYSTEM
  252. }
  253. # tag:allocator
  254. when ($OS_DARWIN == "yes") {
  255. DEFAULT_ALLOCATOR=SYSTEM
  256. }
  257. # tag:allocator
  258. when ($OS_LINUX == "yes") {
  259. when ($GCC) {
  260. # tcmalloc broken build
  261. }
  262. elsewhen ($SANDBOXING) {
  263. # broken
  264. }
  265. elsewhen ($ARCH_X86_64) {
  266. DEFAULT_ALLOCATOR=TCMALLOC_TC
  267. }
  268. }
  269. # tag:allocator
  270. when ($SANITIZER_TYPE) {
  271. when ($SANITIZER_TYPE != "no") {
  272. DEFAULT_ALLOCATOR=SYSTEM
  273. }
  274. }
  275. # tag:allocator
  276. when ($ARCH_XTENSA == "yes") {
  277. DEFAULT_ALLOCATOR=FAKE
  278. }
  279. # tag:internal
  280. ### @usage: CHECK_CONFIG_H(<conf_header>) # internal
  281. ###
  282. ### This internal macro adds checking code for configuration header in external (contrib) library.
  283. ### The check is needed to avoid conflicts on certain types and functions available in arcadia.
  284. ###
  285. ### @see https://a.yandex-team.ru/arc/trunk/arcadia/build/scripts/check_config_h.py for exact details
  286. macro CHECK_CONFIG_H(Conf) {
  287. .CMD=$YMAKE_PYTHON ${input:"build/scripts/check_config_h.py"} ${input;rootrel:Conf} ${output;nopath;noext:Conf.config.cpp} ${kv;hide:"p CH"} ${kv;hide:"pc yellow"}
  288. OUTPUT_INCLUDES=$Conf
  289. }
  290. REQUIRED_TRANSITIVE_PEERS=
  291. ### @usage REQUIRES(dirs...)
  292. ###
  293. ### Specify list of dirs which this module must depend on indirectly.
  294. ###
  295. ### This macro can be used if module depends on the directories specified but they can't be listed
  296. ### as direct PEERDIR dependencies (due to public include order or link order issues).
  297. macro REQUIRES(DIRS[]) {
  298. SET_APPEND(REQUIRED_TRANSITIVE_PEERS $DIRS)
  299. }
  300. CHECK_DEPENDENT_DIRS_TYPES=
  301. CHECK_DEPENDENT_DIRS_RESTRICTIONS=
  302. ### @usage CHECK_DEPENDENT_DIRS(DENY|ALLOW_ONLY ([ALL|PEERDIRS|GLOB] dir)...)
  303. ###
  304. ### Specify project transitive dependencies constraints.
  305. ###
  306. ### @params:
  307. ### 1. DENY: current module can not depend on module from any specified directory neither directly nor transitively.
  308. ### 2. ALLOW_ONLY: current module can not depend on module from a dir not specified in the directory list neither directly nor transitively.
  309. ### 3. ALL: directory constraints following after this modifier are applied to both transitive PEERDIR dependencies and tool dependencies.
  310. ### 4. PEERDIRS: directory constraints following after this modifier are applied to transitive PEERDIR dependencies only.
  311. ### 5. GLOB: next directory constraint is an ANT glob pattern.
  312. ### 6. EXCEPT: next constraint is an exception for the rest of other rules.
  313. ###
  314. ### Directory constraints added before either ALL or PEERDIRS modifier is used are treated as ALL directory constraints.
  315. ###
  316. ### Note: Can be used multiple times on the same module all specified constraints will be checked.
  317. ### All macro invocation for the same module must use same constraints type (DENY or ALLOW_ONLY)
  318. macro CHECK_DEPENDENT_DIRS(TYPE, ALL?"UNUSED":"", PEERDIRS?"PEERDIRS":"ALL", RESTRICTIONS...) {
  319. SET_APPEND(CHECK_DEPENDENT_DIRS_RESTRICTIONS $PEERDIRS $RESTRICTIONS)
  320. SET_APPEND(CHECK_DEPENDENT_DIRS_TYPES $TYPE)
  321. }
  322. macro _RESOURCE_SEM(INPUTS[], KEYS[]) {
  323. SET(RESOURCE_OUTPUT ${hash:INPUTS}.cpp)
  324. .SEM=resources ${output;global:RESOURCE_OUTPUT} INPUTS ${input:INPUTS} KEYS $KEYS ${tool;hide:"tools/rescompiler/bin"}
  325. }
  326. # tag:built-in
  327. ### @usage: RESOURCE([FORCE_TEXT ][Src Key]* [- Key=Value]*) # built-in
  328. ### Add data (resources, random files, strings) to the program)
  329. ### The common usage is to place Src file into binary. The Key is used to access it using library/cpp/resource or library/python/resource.
  330. ### Alternative syntax with '- Key=Value' allows placing Value string as resource data into binary and make it accessible by Key.
  331. ###
  332. ### This is a simpler but less flexible option than ARCHIVE(), because in the case of ARCHIVE(), you have to use the data explicitly,
  333. ### and in the case of RESOURCE(), the data will fall through SRCS() or SRCS(GLOBAL) to binary linking.
  334. ###
  335. ### Use the FORCE_TEXT parameter to explicitly mark all Src files as text files: they will not be parsed unless used elsewhere.
  336. ###
  337. ### @example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a2ispolzujjtekomanduresource
  338. ###
  339. ### @example:
  340. ###
  341. ### LIBRARY()
  342. ### OWNER(user1)
  343. ###
  344. ### RESOURCE(
  345. ### path/to/file1 /key/in/program/1
  346. ### path/to/file2 /key2
  347. ### )
  348. ### END()
  349. ###
  350. macro RESOURCE(Args...) {
  351. PEERDIR(library/cpp/resource)
  352. }
  353. # tag:sanitize
  354. RUN_NO_SANITIZE=$YMAKE_PYTHON ${input:"build/scripts/run_tool.py"} --
  355. # tag:sanitize
  356. when ($IS_CROSS_SANITIZE) {
  357. RUN_NO_SANITIZE=
  358. }
  359. YIELD=$YMAKE_PYTHON ${input:"build/scripts/yield_line.py"} -- ${BINDIR}/__args
  360. XARGS=$YMAKE_PYTHON ${input:"build/scripts/xargs.py"} -- ${BINDIR}/__args
  361. WRITER_PY=$YMAKE_PYTHON ${input:"build/scripts/writer.py"} ${input;hide:"build/scripts/process_command_files.py"}
  362. FS_TOOLS=$YMAKE_PYTHON ${input:"build/scripts/fs_tools.py"} ${input;hide:"build/scripts/process_command_files.py"}
  363. FIX_MSVC_OUTPUT=${YMAKE_PYTHON} ${input:"build/scripts/fix_msvc_output.py"} ${input;hide:"build/scripts/process_command_files.py"}
  364. _PROCESS_WHOLE_ARCHIVE_SCRIPT=${input;hide:"build/scripts/process_command_files.py"} ${input;hide:"build/scripts/process_whole_archive_option.py"}
  365. COPY_CMD=$FS_TOOLS copy
  366. LINK_OR_COPY_CMD=$FS_TOOLS link_or_copy
  367. REMOVE_FILE=$FS_TOOLS remove
  368. MOVE_FILE=$FS_TOOLS rename
  369. # tag:allocator tag:windows-specific
  370. MSVC_DYNAMICBASE=/DYNAMICBASE
  371. when ($ALLOCATOR == "LF") {
  372. MSVC_DYNAMICBASE=/DYNAMICBASE:NO
  373. }
  374. # tag:sanitize
  375. SANITIZER_CFLAGS=
  376. # variables must be defined for all module types to make generate_mf.py work
  377. NEED_PLATFORM_PEERDIRS=yes
  378. PEERDIR_TEST_TOOL=yes
  379. ### @usage: _BARE_UNIT # internal
  380. ###
  381. ### The base of all modules describing default bare minimum for all modules.
  382. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  383. module _BARE_UNIT {
  384. .EXTS=.*
  385. .CMD=TOUCH_UNIT
  386. .IGNORED=GO_PROTO_PLUGIN
  387. .NODE_TYPE=Bundle
  388. .PEERDIR_POLICY=as_include
  389. .RESTRICTED=GRPC USE_SKIFF INDUCED_DEPS FUZZ_DICTS FUZZ_OPTS PACK EXPLICIT_OUTPUTS DOCS_DIR DOCS_CONFIG DOCS_VARS YT_SPEC USE_CXX USE_UTIL WHOLE_ARCHIVE PRIMARY_OUTPUT SECONDARY_OUTPUT DEPENDENCY_MANAGEMENT EXCLUDE NO_DOCTESTS EMBED_JAVA_VCS_INFO RESOURCE_FILES PACK_GLOBALS_IN_LIBRARY _EXPOSE GLOBAL_DEPS LIST_PROTO
  390. .FINAL_TARGET=no
  391. PEERDIR_TAGS=__EMPTY__
  392. PEERDIR+=$YMAKE_PYTHON3_PEERDIR
  393. when ($FATAL_ERROR_MESSAGE && $FATAL_ERROR_MODULE != "yes") {
  394. PEERDIR+=build/conf_fatal_error
  395. }
  396. DEFAULT(MODULE_VERSION)
  397. DEFAULT(MODULE_PREFIX)
  398. DEFAULT(MODULE_SUFFIX)
  399. }
  400. ### @usage: GEN_LIBRARY()
  401. ###
  402. ### Definition of a module that brings generated artefacts. This module can PEERDIRed
  403. ### from any module. The resulted module is empty and cleaned up during construction
  404. ### of the build graph.
  405. ###
  406. ### NOTE! SRCS macro is not supported for this library.
  407. module GEN_LIBRARY: _BARE_UNIT {
  408. .PROXY=yes
  409. .RESTRICTED=SRCS SRC
  410. .SEM=IGNORED
  411. # ENABLE(_FAKE_MODULE)
  412. SET(MODULE_SUFFIX .pkg.fake)
  413. }
  414. ### @usage: _BASE_UNIT # internal
  415. ###
  416. ### The base of all LIBRARY/PROGRAM modules describing common logic for all modules.
  417. ### To avoid surprises, all buildable modules are better to be inherited from it or its descendants.
  418. module _BASE_UNIT: _BARE_UNIT {
  419. .GLOBAL=_FBS_NAMESPACE_MAP
  420. PEERDIR_TAGS=CPP_PROTO CPP_FBS H_IDL PY2 PY2_NATIVE YQL_UDF_STATIC __EMPTY__ DLL_LIB
  421. CPP_PROTO_CMDLINE=${cwd;rootdir;input:File} $PROTOC -I=./$PROTO_NAMESPACE -I=$ARCADIA_ROOT/$PROTO_NAMESPACE ${pre=-I=:_PROTO__INCLUDE} -I=$ARCADIA_BUILD_ROOT -I=$PROTOBUF_PATH --cpp_out=${CPP_PROTO_PLUGINS}$ARCADIA_BUILD_ROOT/$PROTO_NAMESPACE $_PROTOC_FLAGS $PROTOC_STYLEGUIDE_OUT $PROTOC_PLUGIN_STYLEGUIDE ${input;rootrel:File} ${hide:PROTO_FAKEID}
  422. CPP_PROTO_OUTS+=${output;hide;norel;nopath;noext:File.pb.cc} ${output;main;hide;norel;nopath;noext:File.pb.h}
  423. CPP_PROTO_OUTS_SEM+=${output;main;hide;norel;nopath;noext:File.pb.h}
  424. CPP_EV_OUTS+=${output;hide;norel:File.pb.cc} ${output;hide;norel:File.pb.h}
  425. CPP_EV_OUTS_SEM+=${output;hide;norel:File.pb.h}
  426. when ($SWIG_LANG == "perl") {
  427. _SWIG_CMD=$_SWIG_PERL_CMD
  428. _SWIG_PEERDIR=contrib/tools/swig/Lib/perl5 build/platform/perl
  429. }
  430. elsewhen ($SWIG_LANG == "python") {
  431. _SWIG_CMD=$_SWIG_PYTHON_CMD
  432. _SWIG_PEERDIR=contrib/tools/swig/Lib/python
  433. }
  434. elsewhen ($SWIG_LANG == "jni_cpp") {
  435. _SWIG_CMD=$_SWIG_JNI_CPP_CMD
  436. _SWIG_PEERDIR=contrib/tools/swig/Lib/java $_SWIG_JNI_PEERDIR
  437. }
  438. elsewhen ($SWIG_LANG == "java") {
  439. _SWIG_CMD=$_SWIG_JNI_CMD
  440. _SWIG_PEERDIR=contrib/tools/swig/Lib/java $_SWIG_JNI_PEERDIR
  441. }
  442. when ($PY_PROTOS_FOR == "yes") {
  443. _EVLOG_CMDLINE=$_PY_EVLOG_CMDLINE
  444. _PROTO_CMDLINE=$_PY_PROTO_CMDLINE
  445. }
  446. otherwise {
  447. _EVLOG_CMDLINE=$_CPP_EVLOG_CMDLINE
  448. _FBS_CMDLINE=$_CPP_FLATC_CMDLINE
  449. when ($BUILD_PROTO_AS_EVLOG == "yes") {
  450. _PROTO_CMDLINE=$_CPP_PROTO_EVLOG_CMDLINE
  451. }
  452. otherwise {
  453. _PROTO_CMDLINE=$_CPP_PROTO_CMDLINE
  454. }
  455. when ($USE_VANILLA_PROTOC == "yes") {
  456. PROTOC=${tool:"contrib/tools/protoc_std"}
  457. PROTOC_STYLEGUIDE_OUT=
  458. PROTOC_PLUGIN_STYLEGUIDE=
  459. PROTOBUF_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf_std
  460. _PROTO_CMDLINE=$_CPP_VANILLA_PROTO_CMDLINE
  461. }
  462. when ($PROTOC_TRANSITIVE_HEADERS == "no") {
  463. CPP_PROTO_PLUGINS=transitive_pb_h=false:${CPP_PROTO_PLUGINS}
  464. }
  465. }
  466. SANITIZER_DEFINED=no
  467. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  468. CFLAGS+=-fsanitize=$SANITIZER_TYPE -D${SANITIZER_TYPE}_sanitizer_enabled $SANITIZER_CFLAGS -fno-omit-frame-pointer
  469. LDFLAGS+=-fsanitize=$SANITIZER_TYPE
  470. SANITIZER_DEFINED=yes
  471. when ($CLANG) {
  472. CFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"} -fno-sanitize-link-runtime
  473. LDFLAGS+=-fsanitize-blacklist=${input:"build/sanitize-blacklist.txt"} -fno-sanitize-link-runtime
  474. }
  475. }
  476. when ($SANITIZER_TYPE && $SANITIZER_TYPE == "memory") {
  477. CFLAGS+=-fno-sanitize-memory-use-after-dtor -Wno-unused-command-line-argument
  478. }
  479. when ($SANITIZE_COVERAGE && $SANITIZE_COVERAGE != "no") {
  480. CFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  481. LDFLAGS+=-fsanitize-coverage=$SANITIZE_COVERAGE
  482. }
  483. POPULATE_CPP_COVERAGE_FLAGS()
  484. when ($NLG_COVERAGE && $NLG_COVERAGE != "no") {
  485. CFLAGS+=-DNLG_COVERAGE
  486. }
  487. when ($GCC) {
  488. select ($SANITIZER_TYPE) {
  489. "address" ? {
  490. LDFLAGS+=-static-libasan
  491. }
  492. "undefined" ? {
  493. LDFLAGS+=-static-libubsan
  494. }
  495. "thread" ? {
  496. PIE=yes
  497. LDFLAGS+=-static-libtsan
  498. }
  499. }
  500. }
  501. when ($HARDENING == "yes") {
  502. when ($CLANG) {
  503. CFLAGS+=-fstack-protector-all -D_hardening_enabled_
  504. LDFLAGS+=-z relro -z now -z noexecstack
  505. PIE=yes
  506. }
  507. }
  508. when ($USE_LTO == "yes") {
  509. when ($GCC) {
  510. CFLAGS+=-flto -fno-fat-lto-objects
  511. LDFLAGS+=-flto
  512. NO_LTO_CFLAGS=-fno-lto
  513. }
  514. when ($CLANG) {
  515. CFLAGS+=-flto
  516. LDFLAGS+=-flto
  517. NO_LTO_CFLAGS=-fno-lto
  518. }
  519. }
  520. when ($USE_THINLTO == "yes") {
  521. when ($GCC) {
  522. CFLAGS+=-flto=thin
  523. LDFLAGS+=-flto=thin
  524. NO_LTO_CFLAGS=-fno-lto
  525. }
  526. when ($CLANG) {
  527. CFLAGS+=-flto=thin
  528. LDFLAGS+=-flto=thin
  529. NO_LTO_CFLAGS=-fno-lto
  530. }
  531. }
  532. when ($CLANG) {
  533. when ($PGO_ADD == "yes") {
  534. CFLAGS+=-fprofile-instr-generate
  535. LDFLAGS+=-fprofile-instr-generate
  536. }
  537. when ($PGO_PATH) {
  538. CFLAGS+=-fprofile-instr-use=$PGO_PATH -Wno-profile-instr-unprofiled -Wno-profile-instr-out-of-date
  539. LDFLAGS+=-fprofile-instr-use=$PGO_PATH
  540. }
  541. }
  542. when ($COMPILER_PLATFORM && $NEED_PLATFORM_PEERDIRS == "yes") {
  543. PEERDIR+=$COMPILER_PLATFORM
  544. }
  545. when ($OS_LINUX && $NEED_PLATFORM_PEERDIRS == "yes") {
  546. PEERDIR+=contrib/libs/linux-headers
  547. # For discussion see DTCC-553
  548. MODULE_LICENSES_RESTRICTION_EXCEPTIONS+=contrib/libs/linux-headers
  549. }
  550. # Adding PEERDIR from trigger doesn't always work. In this case it
  551. # cause troubles in contrib/libs/libc_compat/ubuntu_14 under musl
  552. # Workaround this issue by setting variable with PEERDIR in trigger
  553. # and then adding PEERDIR to it's value unconditionally.
  554. when ($USE_UBUNTU_COMPATIBILITY == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  555. _UBUNTU_COMPAT_PEERDIR=contrib/libs/libc_compat/ubuntu_14
  556. }
  557. otherwise {
  558. _UBUNTU_COMPAT_PEERDIR=
  559. }
  560. PEERDIR+=$_UBUNTU_COMPAT_PEERDIR
  561. when ($NORUNTIME != "yes") {
  562. PEERDIR+=contrib/libs/cxxsupp
  563. when ($MAPSMOBI_BUILD_TARGET == "yes") {
  564. PEERDIR+=build/platform/mapkit
  565. }
  566. }
  567. when ($NOUTIL != "yes") {
  568. PEERDIR+=util
  569. }
  570. when ($MUSL == "yes") {
  571. CFLAGS += -D_musl_
  572. LINK_DYN_LIB_FLAGS += --musl
  573. LINK_SCRIPT_EXE_FLAGS += --musl
  574. PEERDIR+=contrib/libs/musl/include
  575. }
  576. # g++ has proxy C-headers which are incompatible with libc++ proxy C-headers.
  577. # The same problem exists for clang toolchain. On the other hand, the problem
  578. # doesn't affect cl since it has united C/C++ library and doesn't need
  579. # proxy C-headers.
  580. # Disable all C++ headers including proxy C-headers when we use libc++.
  581. when ($USE_INTERNAL_STL == "yes" && $MSVC != "yes") {
  582. CXXFLAGS += -nostdinc++
  583. }
  584. otherwise {
  585. CFLAGS += -DUSE_STL_SYSTEM
  586. }
  587. when ($CODENAVIGATION && $NOCODENAVIGATION != "yes") {
  588. PEERDIR += build/external_resources/codenavigation
  589. }
  590. when ($CYTHON_COVERAGE && $CYTHON_COVERAGE == "yes") {
  591. CFLAGS+=-DCYTHON_TRACE=1 -DCYTHON_TRACE_NOGIL=1
  592. }
  593. DEFAULT(USE_SSE4 yes)
  594. when ($NOSSE != "yes") {
  595. CFLAGS+=$SSE_CFLAGS
  596. C_DEFINES+=$SSE_DEFINES
  597. when ($USE_SSE4 == "yes") {
  598. CFLAGS+=$SSE4_CFLAGS
  599. C_DEFINES+=$SSE4_DEFINES
  600. }
  601. }
  602. elsewhen ($MSVC != "yes") {
  603. CFLAGS += -mno-sse
  604. }
  605. POPULATE_CPP_COVERAGE_FLAGS()
  606. _REGISTER_NO_CHECK_IMPORTS()
  607. DEFAULT(PACKAGE_PREFIX_ARGS)
  608. DEFAULT(SWIG_LANG python)
  609. DEFAULT(GP_FLAGS -CtTLANSI-C -Dk* -c)
  610. when ($NEED_BINUTILS_PEERDIR && $BINUTILS_USED && $NEED_PLATFORM_PEERDIRS == "yes") {
  611. PEERDIR+=build/platform/binutils
  612. }
  613. }
  614. _LINKER_ID=
  615. # GCC does not support -fuse-ld with an executable path,
  616. # only -fuse-ld=gold or -fuse-ld=lld.
  617. when ($_LINKER_ID != "" && $_DEFAULT_LINKER_ID != "" && $CLANG == "yes" && $NEED_PLATFORM_PEERDIRS == "yes") {
  618. when ($_LINKER_ID in [ "gold", "lld" ]) {
  619. PEERDIR+=build/platform/${_LINKER_ID}
  620. }
  621. }
  622. macro _USE_LINKER_IMPL(LINKER_ID...) {
  623. SET(_LINKER_ID $LINKER_ID)
  624. }
  625. macro _USE_LINKER() {
  626. _USE_LINKER_IMPL($_DEFAULT_LINKER_ID)
  627. }
  628. ### @usage: USE_LINKER_GOLD()
  629. ### Use gold linker for a program. This doesn't work in libraries
  630. macro USE_LINKER_GOLD() {
  631. _USE_LINKER_IMPL(gold)
  632. }
  633. COMMON_LINK_SETTINGS=
  634. LINK_ADDITIONAL_SECTIONS=
  635. LINK_ADDITIONAL_SECTIONS_COMMAND=
  636. when ($COMMON_LINK_SETTINGS == "yes") {
  637. when ($_LINKER_ID == "lld" && ($OS_LINUX == "yes" || $OS_ANDROID == "yes")) {
  638. LDFLAGS += -Wl,--gdb-index
  639. }
  640. when ($EMBED_LINKER_CREF == "yes") {
  641. LDFLAGS+=-Wl,--cref ${tmp;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  642. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_cref=${tmp;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME}
  643. }
  644. elsewhen ($DUMP_LINKER_CREF == "yes") {
  645. LDFLAGS+=-Wl,--cref ${output;stdout;pre=$MODULE_PREFIX;suf=.ldcref:REALPRJNAME} -Wl,--no-demangle
  646. }
  647. when ($EMBED_LINKER_MAP == "yes") {
  648. LDFLAGS+=-Wl,-Map=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  649. LINK_ADDITIONAL_SECTIONS+=--add-section=.ya.linker_map.${_LINKER_ID}=${tmp;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  650. }
  651. elsewhen ($DUMP_LINKER_MAP == "yes") {
  652. LDFLAGS+=-Wl,-Map=${output;rootrel;pre=$MODULE_PREFIX;suf=.map.$_LINKER_ID:REALPRJNAME}
  653. }
  654. when ($USE_MKL == "yes") {
  655. NOPLATFORM=yes
  656. }
  657. when ($AUTOCHECK == "yes" && $OS_LINUX == "yes") {
  658. PEERDIR+=contrib/libs/libeatmydata
  659. # We can not use LICENSE_RESTRICTION_EXCEPTIONS() macro inside a trigger.
  660. # Duplicate its implementation here
  661. MODULE_LICENSES_RESTRICTION_EXCEPTIONS+=contrib/libs/libeatmydata
  662. }
  663. when ($USE_ARCADIA_LIBM == "yes") {
  664. PEERDIR+=contrib/libs/libm
  665. }
  666. when ($USE_ARCADIA_LIBM == "no") {
  667. C_SYSTEM_LIBRARIES+=-lm
  668. }
  669. when (($MUSL != "yes" && $WITH_VALGRIND == "yes") || $SANITIZER_DEFINED == "yes") {
  670. when ($ALLOCATOR in [ "TCMALLOC", "TCMALLOC_SMALL_BUT_SLOW", "TCMALLOC_NUMA_256K", "TCMALLOC_NUMA_LARGE_PAGES", "TCMALLOC_256K", "TCMALLOC_TC", "GOOGLE", "J", "LF", "LF_YT", "LF_DBG", "B", "BM", "C", "LOCKLESS", "YT", "YT_TCMALLOC", "YT_TCMALLOC_256K", "MIM", "HU", "PROFILED_HU", "THREAD_PROFILED_HU" ]) {
  671. PEERDIR+=library/cpp/malloc/system
  672. }
  673. }
  674. otherwise {
  675. select ($ALLOCATOR) {
  676. "MIM" ? {
  677. PEERDIR+=library/cpp/malloc/mimalloc
  678. }
  679. "HU" ? {
  680. PEERDIR+=library/cpp/malloc/hu
  681. }
  682. "PROFILED_HU" ? {
  683. PEERDIR+=library/cpp/malloc/profiled_hu
  684. }
  685. "THREAD_PROFILED_HU" ? {
  686. PEERDIR+=library/cpp/malloc/thread_profiled_hu
  687. }
  688. "TCMALLOC_256K" ? {
  689. PEERDIR+=library/cpp/malloc/tcmalloc
  690. PEERDIR+=contrib/libs/tcmalloc
  691. }
  692. "TCMALLOC_SMALL_BUT_SLOW" ? {
  693. PEERDIR+=library/cpp/malloc/tcmalloc
  694. PEERDIR+=contrib/libs/tcmalloc/small_but_slow
  695. }
  696. "TCMALLOC_NUMA_256K" ? {
  697. PEERDIR+=library/cpp/malloc/tcmalloc
  698. PEERDIR+=contrib/libs/tcmalloc/numa_256k
  699. }
  700. "TCMALLOC_NUMA_LARGE_PAGES" ? {
  701. PEERDIR+=library/cpp/malloc/tcmalloc
  702. PEERDIR+=contrib/libs/tcmalloc/numa_large_pages
  703. }
  704. "TCMALLOC" ? {
  705. PEERDIR+=library/cpp/malloc/tcmalloc
  706. PEERDIR+=contrib/libs/tcmalloc/default
  707. }
  708. "TCMALLOC_TC" ? {
  709. PEERDIR+=library/cpp/malloc/tcmalloc
  710. PEERDIR+=contrib/libs/tcmalloc/no_percpu_cache
  711. }
  712. "GOOGLE" ? {
  713. PEERDIR+=library/cpp/malloc/galloc
  714. }
  715. "J" ? {
  716. when ($WIN32 == "yes") {
  717. PEERDIR+=library/cpp/malloc/system
  718. }
  719. otherwise {
  720. PEERDIR+=library/cpp/malloc/jemalloc
  721. }
  722. }
  723. "LF" ? {
  724. PEERDIR+=library/cpp/lfalloc
  725. }
  726. "LF_YT" ? {
  727. PEERDIR+=library/cpp/lfalloc/yt
  728. }
  729. "LF_DBG" ? {
  730. PEERDIR+=library/cpp/lfalloc/dbg
  731. }
  732. "B" ? {
  733. PEERDIR+=library/cpp/balloc
  734. }
  735. "BM" ? {
  736. PEERDIR+=library/cpp/balloc_market
  737. }
  738. "C" ? {
  739. PEERDIR+=library/cpp/malloc/calloc
  740. }
  741. "LOCKLESS" ? {
  742. PEERDIR+=library/cpp/malloc/lockless
  743. }
  744. "YT" ? {
  745. PEERDIR+=library/cpp/ytalloc/impl
  746. }
  747. "YT_TCMALLOC" ? {
  748. PEERDIR+=library/cpp/malloc/tcmalloc
  749. PEERDIR+=contrib/libs/yt_tcmalloc/default
  750. }
  751. "YT_TCMALLOC_256K" ? {
  752. PEERDIR+=library/cpp/malloc/tcmalloc
  753. PEERDIR+=contrib/libs/yt_tcmalloc
  754. }
  755. }
  756. }
  757. when ($ALLOCATOR == "SYSTEM") {
  758. PEERDIR+=library/cpp/malloc/system
  759. }
  760. when ($WERROR != "no") {
  761. when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
  762. C_WARNING_OPTS += $WERROR_FLAG
  763. }
  764. }
  765. when ($ICC == "yes") {
  766. PEERDIR+=contrib/libs/intel/core
  767. }
  768. when ($WITH_VALGRIND == "yes") {
  769. PEERDIR+=contrib/libs/valgrind
  770. # https://st.yandex-team.ru/DTCC-122
  771. CFLAGS+=-fdebug-default-version=4
  772. }
  773. }
  774. when ($EMBED_LINKER_MAP == "yes" || $EMBED_LINKER_CREF == "yes") {
  775. LINK_ADDITIONAL_SECTIONS_COMMAND+= \
  776. $OBJCOPY_TOOL $LINK_ADDITIONAL_SECTIONS $TARGET
  777. }
  778. _SO_EXT_FILTER=${ext=.so:PEERS} ${hide;late_out;nopath;ext=.so;pre=$BINDIR/:PEERS}
  779. when ($OS_WINDOWS == "yes") {
  780. _SO_EXT_FILTER=${ext=.dll:PEERS} ${hide;late_out;nopath;ext=.dll;pre=$BINDIR/:PEERS}
  781. }
  782. elsewhen ($OS_DARWIN == "yes" || $OS_IOS == "yes") {
  783. _SO_EXT_FILTER=${ext=.dylib:PEERS} ${hide;late_out;nopath;ext=.dylib;pre=$BINDIR/:PEERS}
  784. }
  785. LINK_OR_COPY_SO_CMD=
  786. RPATH_GLOBAL=
  787. when ($SO_OUTPUTS == "yes") {
  788. LINK_OR_COPY_SO_CMD=$FS_TOOLS link_or_copy_to_dir --no-check $_SO_EXT_FILTER ${BINDIR}
  789. LDFLAGS+=$RPATH_GLOBAL
  790. }
  791. # tag:restricted tag:DLL
  792. ### $usage: WITH_DYNAMIC_LIBS() # restricted
  793. ###
  794. ### Include dynamic libraries as extra PROGRAM/DLL outputs
  795. macro WITH_DYNAMIC_LIBS() {
  796. ENABLE(SO_OUTPUTS)
  797. }
  798. # tag:internal
  799. ### $usage: REAL_LINK_EXE_IMPL(peers...) # internal
  800. macro REAL_LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  801. .CMD=$REAL_LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  802. }
  803. # tag:internal
  804. ### $usage: REAL_LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  805. macro REAL_LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  806. .CMD=$REAL_LINK_EXEC_DYN_LIB_CMDLINE
  807. }
  808. # tag:internal
  809. ### $usage: REAL_LINK_DYN_LIB_IMPL(peers...) # internal
  810. macro REAL_LINK_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  811. .CMD=$REAL_LINK_DYN_LIB_CMDLINE && $LINK_OR_COPY_SO_CMD
  812. }
  813. # tag:internal
  814. ### $usage: LINK_EXE_IMPL(peers...) # internal
  815. macro LINK_EXE_IMPL(WHOLE_ARCHIVE_PEERS...) {
  816. .CMD=$LINK_EXE_CMDLINE && $LINK_OR_COPY_SO_CMD
  817. }
  818. # tag:internal
  819. ### $usage: LINK_EXEC_DYN_LIB_IMPL(peers...) # internal
  820. macro LINK_EXEC_DYN_LIB_IMPL(WHOLE_ARCHIVE_PEERS...) {
  821. .CMD=$LINK_EXEC_DYN_LIB_CMDLINE
  822. }
  823. # tag:internal
  824. ### @usage: _LINK_UNIT # internal
  825. ###
  826. ### The base of all linkable modules: programs, DLLs etc. Describes common linking logic.
  827. module _LINK_UNIT: _BASE_UNIT {
  828. .EXTS=.o .obj .supp .tidyjson .ld
  829. .CMD=LINK_EXE
  830. .ALLOWED=EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  831. .NODE_TYPE=Program
  832. .PEERDIR_POLICY=as_build_from
  833. .FINAL_TARGET=yes
  834. .DEFAULT_NAME_GENERATOR=DirName
  835. .ARGS_PARSER=Base
  836. DEFAULT(ALLOCATOR $DEFAULT_ALLOCATOR)
  837. _USE_LINKER()
  838. #link with libunwind manually
  839. when ($DARWIN == "yes" && $NOPLATFORM != "yes") {
  840. PEERDIR += contrib/libs/cxxsupp
  841. }
  842. when ($NEED_PROFILE_RUNTIME == "yes") {
  843. when ($CLANG16 == "yes") {
  844. LDFLAGS+=-resource-dir=contrib/libs/clang-rt
  845. PEERDIR+=contrib/libs/clang16-rt/lib/profile
  846. }
  847. otherwise {
  848. LDFLAGS+=-resource-dir=contrib/libs/clang-rt
  849. PEERDIR+=contrib/libs/clang14-rt/lib/profile
  850. }
  851. }
  852. when ($USE_LIBCXXRT == "yes") {
  853. PEERDIR += contrib/libs/cxxsupp/libcxxrt
  854. }
  855. when ($USE_DYNAMIC_CUDA == "yes") {
  856. LINK_DYN_LIB_FLAGS += --dynamic-cuda
  857. LINK_SCRIPT_EXE_FLAGS += --dynamic-cuda
  858. }
  859. when ($OPENSOURCE == "yes" && $AUTOCHECK == "yes") {
  860. # FIXME: Replace AUTOCHECK == yes with _not a host platform_ check after YMAKE-218
  861. MODULE_LICENSES_RESTRICTION_TYPES = ALLOW_ONLY
  862. MODULE_LICENSES_RESTRICTIONS = SERVICE REQUIRE_CITATION
  863. }
  864. when ($OS_IOS == "yes" || $OS_ANDROID == "yes" || $MAPSMOBI_BUILD_TARGET == "yes") {
  865. MODULE_LICENSES_RESTRICTION_TYPES = ALLOW_ONLY
  866. MODULE_LICENSES_RESTRICTIONS = SERVICE REQUIRE_CITATION
  867. }
  868. ENABLE(COMMON_LINK_SETTINGS)
  869. CHECK_PROVIDES()
  870. }
  871. MODULE_TYPE=UNKNOWN
  872. macro ADD_CLANG_TIDY() {
  873. ADD_YTEST($MODULE_PREFIX$REALPRJNAME clang_tidy)
  874. when ($TIDY_ENABLED == "yes") {
  875. _MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_project_map.json
  876. _MAKEFILE_INCLUDE_LIKE_DEPS+=${ARCADIA_ROOT}/build/yandex_specific/config/clang_tidy/tidy_default_map.json
  877. }
  878. }
  879. # tag:internal
  880. ### @usage: _BASE_PROGRAM # internal
  881. ###
  882. ### The base of all programs. It adds dependencies to make final artefact complete and runnable.
  883. module _BASE_PROGRAM: _LINK_UNIT {
  884. .SYMLINK_POLICY=EXE
  885. .ALLOWED=INDUCED_DEPS WHOLE_ARCHIVE
  886. .GLOBAL=LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  887. SET(MODULE_TYPE PROGRAM)
  888. SET(MODULE_LANG CPP)
  889. FORCE_COVERAGE_ENABLED=yes
  890. when ($OS_IOS == "yes") {
  891. EXTS+=.ios.interface
  892. }
  893. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  894. MODULE_SUFFIX=.exe
  895. }
  896. when ($TIDY_ENABLED == "yes") {
  897. MODULE_SUFFIX=.tidyjson
  898. }
  899. when ($MSVC != "yes" && $NOPLATFORM != "yes" && $WITH_VALGRIND != "yes" && $USE_ASMLIB != "no" && $MIC_ARCH != "yes" && $PIC != "yes" && $PIE != "yes") {
  900. when ($OS_LINUX == "yes" && $ARCH_X86_64 == "yes" && $MUSL != "yes" && $SANITIZER_DEFINED != "yes" && $USE_THINLTO != "yes") {
  901. PEERDIR+=contrib/libs/glibcasm
  902. }
  903. otherwise {
  904. PEERDIR+=contrib/libs/asmlib
  905. }
  906. }
  907. when ($MUSL == "yes") {
  908. when ($MUSL_LITE == "yes") {
  909. PEERDIR += contrib/libs/musl
  910. }
  911. otherwise {
  912. PEERDIR += contrib/libs/musl/full
  913. }
  914. }
  915. DEFAULT(CPU_CHECK yes)
  916. when ($USE_SSE4 != "yes" || $NOUTIL == "yes" || $ALLOCATOR == "FAKE") {
  917. CPU_CHECK = no
  918. }
  919. when ($CPU_CHECK == "yes") {
  920. PEERDIR += library/cpp/cpuid_check
  921. }
  922. when ($USE_ARC_PROFILE == "yes" && $NOUTIL != "yes") {
  923. PEERDIR += library/cpp/execprofile/autostart
  924. }
  925. when ($SANITIZER_TYPE && $SANITIZER_TYPE != "no") {
  926. PEERDIR += contrib/libs/cxxsupp/libsan
  927. when ($CLANG) {
  928. select ($TARGET_PLATFORM) {
  929. "LINUX" ? {
  930. PEERDIR += library/cpp/sanitizer/${SANITIZER_TYPE}/static
  931. }
  932. "DARWIN" ? {
  933. # Memory sanitizer is not supported for darwin platform.
  934. # https://clang.llvm.org/docs/MemorySanitizer.html#supported-platforms
  935. when ($SANITIZER_TYPE != "memory") {
  936. PEERDIR += library/cpp/sanitizer/${SANITIZER_TYPE}/dynamic
  937. }
  938. }
  939. default ? {
  940. FATAL_ERROR_MESSAGE+=Unsupported platform for sanitizer
  941. }
  942. }
  943. }
  944. }
  945. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  946. PEERDIR+=library/cpp/testing/dump_clang_coverage
  947. }
  948. when ($IDE_MSVS == "yes") {
  949. PEERDIR+=build/scripts/c_templates
  950. }
  951. when ($_CUSTOM_LINK_STEP_SCRIPT) {
  952. LINK_SCRIPT_EXE_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT}
  953. }
  954. }
  955. VCS_INFO_SEM=vcs_info ${input;hide:"build/scripts/vcs_info.py"} ${input;hide:"build/scripts/c_templates/svn_interface.c"} ${input;hide:"build/scripts/c_templates/svnversion.h"}
  956. CPP_PROGRAM_SEM=add_executable $MODDIR $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
  957. && ${VCS_INFO_SEM} \
  958. && target_link_options PRIVATE $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE \
  959. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  960. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  961. && target_compile_options PRIVATE $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW
  962. ### @usage: PROGRAM([progname])
  963. ###
  964. ### Regular program module.
  965. ### If name is not specified it will be generated from the name of the containing project directory.
  966. module PROGRAM: _BASE_PROGRAM {
  967. .SEM=CPP_PROGRAM_SEM
  968. ADD_YTEST($MODULE_PREFIX$REALPRJNAME coverage.extractor)
  969. ADD_CLANG_TIDY()
  970. _DONT_REQUIRE_LICENSE()
  971. }
  972. ### @usage: EXPORTS_SCRIPT(exports_file)
  973. ###
  974. ### Specify exports script within PROGRAM, DLL and DLL-derived modules.
  975. ### This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files.
  976. ### The other option use EXPORTS parameter of the DLL module itself.
  977. ###
  978. ### @see: [DLL](#module_DLL)
  979. macro EXPORTS_SCRIPT(Arg) {
  980. SET(EXPORTS_FILE $Arg)
  981. }
  982. ### @usage: NO_EXPORT_DYNAMIC_SYMBOLS()
  983. ###
  984. ### Disable exporting all non-hidden symbols as dynamic when linking a PROGRAM.
  985. macro NO_EXPORT_DYNAMIC_SYMBOLS() {
  986. ENABLE(NO_EXPORT_DYNAMIC_SYMBOLS)
  987. }
  988. ### @usage: EXPORT_ALL_DYNAMIC_SYMBOLS()
  989. ###
  990. ### Export all non-hidden symbols as dynamic when linking a PROGRAM.
  991. macro EXPORT_ALL_DYNAMIC_SYMBOLS() {
  992. # Dummy: default behaviour
  993. ENABLE(EXPORT_ALL_DYNAMIC_SYMBOLS)
  994. }
  995. ### @usage: USE_DYNAMIC_CUDA()
  996. ###
  997. ### Enable linking of PROGRAM with dynamic CUDA. By default CUDA uses static linking
  998. macro USE_DYNAMIC_CUDA() {
  999. LDFLAGS(-Wl,-rpath,$ORIGIN)
  1000. ENABLE(USE_DYNAMIC_CUDA)
  1001. }
  1002. ### @usage: CUSTOM_LINK_STEP_SCRIPT(name)
  1003. ###
  1004. ### Specifies name of a script for custom link step. The scripts
  1005. ### should be placed in the build/scripts directory and are subject to
  1006. ### review by devtools@.
  1007. macro CUSTOM_LINK_STEP_SCRIPT(Name) {
  1008. SET(_CUSTOM_LINK_STEP_SCRIPT build/scripts/$Name)
  1009. }
  1010. ### @usage: _BASE_UNITTEST # internal
  1011. ###
  1012. ### Module with base logic for all unit-test modules: it makes code runnable as unit-test by Arcadia testing machinery.
  1013. module _BASE_UNITTEST: _BASE_PROGRAM {
  1014. .FINAL_TARGET=no
  1015. .NODE_TYPE=Program
  1016. .ALLOWED=YT_SPEC
  1017. when ($UT_SKIP_EXCEPTIONS == "yes") {
  1018. C_DEFINES+=-DUT_SKIP_EXCEPTIONS
  1019. }
  1020. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1021. # Assume that no code may depend on unit test output and thus
  1022. # do not mandate license markup in such modules.
  1023. _DONT_REQUIRE_LICENSE()
  1024. }
  1025. _TEST_SPLIT_FACTOR_SEM=1
  1026. _TEST_TIMEOUT_SEM=
  1027. _TEST_PARTITION_SEM=
  1028. UNITTEST_SEM=$CPP_PROGRAM_SEM \
  1029. && set_property TARGET $REALPRJNAME PROPERTY SPLIT_FACTOR $_TEST_SPLIT_FACTOR_SEM \
  1030. $_TEST_PARTITION_SEM \
  1031. && add_yunittest NAME $REALPRJNAME TEST_TARGET $REALPRJNAME TEST_ARG --print-before-suite --print-before-test --fork-tests --print-times --show-fails \
  1032. && set_yunittest_property TEST $REALPRJNAME PROPERTY LABELS $TEST_SIZE_NAME $FILTER_ONLY_TEST_TAGS \
  1033. && add_ytest_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
  1034. $_TEST_TIMEOUT_SEM
  1035. # tag:test
  1036. ### @usage: UNITTEST([name])
  1037. ###
  1038. ### Unit test module based on library/cpp/testing/unittest.
  1039. ### It is recommended not to specify the name.
  1040. ###
  1041. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#opisanievya.make1
  1042. module UNITTEST: _BASE_UNITTEST {
  1043. .SEM=UNITTEST_SEM
  1044. .DEFAULT_NAME_GENERATOR=FullPath
  1045. .ARGS_PARSER=Base
  1046. PEERDIR(library/cpp/testing/unittest_main)
  1047. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1048. when ($TEST_FORK_MODE != "none") {
  1049. when ($TEST_SPLIT_FACTOR) {
  1050. _TEST_SPLIT_FACTOR_SEM=$TEST_SPLIT_FACTOR
  1051. }
  1052. otherwise {
  1053. _TEST_SPLIT_FACTOR_SEM=10
  1054. }
  1055. when ($TEST_PARTITION == "MODULO") {
  1056. _TEST_PARTITION_SEM=&& set_property TARGET $REALPRJNAME PROPERTY SPLIT_TYPE $TEST_PARTITION \
  1057. }
  1058. }
  1059. when ($TEST_TIMEOUT) {
  1060. _TEST_TIMEOUT_SEM=&& set_yunittest_property TEST $REALPRJNAME PROPERTY TIMEOUT $TEST_TIMEOUT
  1061. }
  1062. }
  1063. # tag:yt-specific tag:test
  1064. ### @usage: YT_UNITTEST([name])
  1065. ###
  1066. ### YT Unit test module based on library/cpp/testing/unittest with NYT::Initialize hook
  1067. module YT_UNITTEST: _BASE_UNITTEST {
  1068. PEERDIR(library/cpp/testing/unittest_main mapreduce/yt/tests/yt_initialize_hook)
  1069. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1070. }
  1071. # tag:test
  1072. ### @usage: UNITTEST_WITH_CUSTOM_ENTRY_POINT([name])
  1073. ###
  1074. ### Generic unit test module.
  1075. module UNITTEST_WITH_CUSTOM_ENTRY_POINT: _BASE_UNITTEST {
  1076. ADD_YTEST($MODULE_PREFIX$REALPRJNAME unittest.py)
  1077. }
  1078. GTEST_SEM=$CPP_PROGRAM_SEM \
  1079. && add_test NAME $REALPRJNAME COMMAND $REALPRJNAME \
  1080. && set_property TEST $REALPRJNAME PROPERTY LABELS $TEST_SIZE_NAME $FILTER_ONLY_TEST_TAGS \
  1081. && add_test_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
  1082. $_TEST_TIMEOUT_SEM
  1083. # tag:cpp-specific tag:test
  1084. ### @usage: GTEST([name])
  1085. ###
  1086. ### Unit test module based on library/cpp/testing/gtest.
  1087. ### It is recommended not to specify the name.
  1088. ###
  1089. ### Documentation: https://docs.yandex-team.ru/arcadia-cpp/cpp_test
  1090. module GTEST: _BASE_UNITTEST {
  1091. .SEM=GTEST_SEM
  1092. .DEFAULT_NAME_GENERATOR=FullPath
  1093. .ARGS_PARSER=Base
  1094. PEERDIR(library/cpp/testing/gtest library/cpp/testing/gtest_main)
  1095. ADD_YTEST($MODULE_PREFIX$REALPRJNAME gunittest)
  1096. when ($TEST_TIMEOUT) {
  1097. _TEST_TIMEOUT_SEM=&& set_property TEST $REALPRJNAME PROPERTY TIMEOUT $TEST_TIMEOUT
  1098. }
  1099. }
  1100. USE_AFL=no
  1101. # tag:fuzzing
  1102. ### @usage: FUZZ()
  1103. ###
  1104. ### In order to start using Fuzzing in Arcadia, you need to create a FUZZ module with the implementation of the function LLVMFuzzerTestOneInput().
  1105. ### This module should be reachable by RECURSE from /autocheck project in order for the corpus to be regularly updated.
  1106. ### AFL and Libfuzzer are supported in Arcadia via a single interface, but the automatic fuzzing still works only through Libfuzzer.
  1107. ###
  1108. ### Example: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/re2/re2/fuzzing/re2_fuzzer.cc?rev=2919463#L58
  1109. ###
  1110. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1111. module FUZZ: _BASE_PROGRAM {
  1112. .NODE_TYPE=Program
  1113. .FINAL_TARGET=no
  1114. .ALLOWED=FUZZ_DICTS FUZZ_OPTS
  1115. SET(LIBFUZZER_PATH contrib/libs/libfuzzer)
  1116. when ($USE_AFL == "no") {
  1117. PEERDIR+=$LIBFUZZER_PATH
  1118. }
  1119. when ($USE_AFL == "yes") {
  1120. PEERDIR+=$LIBFUZZER_PATH/afl
  1121. }
  1122. when (!$SANITIZER_TYPE || $SANITIZER_TYPE == "no") {
  1123. PEERDIR+=library/cpp/testing/nofuzz
  1124. }
  1125. ADD_YTEST($MODULE_PREFIX$REALPRJNAME fuzz.test)
  1126. }
  1127. # tag:ios-specific
  1128. PACK_IOS_CMD=
  1129. when ($OS_IOS && $BUILD_IOS_APP) {
  1130. PACK_IOS_CMD=$YMAKE_PYTHON ${input:"build/scripts/pack_ios.py"} --binary $TARGET --target $TARGET --temp-dir $BINDIR $PEERS
  1131. }
  1132. LINK_BOOSTTEST_CMD=
  1133. BOOST_TEST_TYPE_STRING=
  1134. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1135. LINK_BOOSTTEST_CMD=$LINK_RECURSIVE_LIBRARY
  1136. BOOST_TEST_TYPE_STRING=no.test
  1137. }
  1138. otherwise {
  1139. LINK_BOOSTTEST_CMD=$LINK_EXE
  1140. BOOST_TEST_TYPE_STRING=boost.test
  1141. }
  1142. # tag:deprecated
  1143. ### @usage: BOOSTTEST([name]) #deprecated
  1144. ###
  1145. ### Test module based on boost/test/unit_test.hpp.
  1146. ### As with entire boost library usage of this technology is deprecated in Arcadia and restricted with configuration error in most of projects.
  1147. ### No new module of this type should be introduced unless it is explicitly approved by C++ committee.
  1148. module BOOSTTEST: _BASE_PROGRAM {
  1149. .NODE_TYPE=Program
  1150. .FINAL_TARGET=no
  1151. .CMD=LINK_BOOSTTEST_CMD
  1152. PEERDIR(library/cpp/testing/boost_test)
  1153. when ($BOOSTTEST_IS_FAT_OBJECT) {
  1154. MODULE_SUFFIX=.a
  1155. }
  1156. elsewhen ($OS_IOS && $BUILD_IOS_APP) {
  1157. PEERDIR+=devtools/boosttest_ios_wrapper/library
  1158. MODULE_SUFFIX=.ios.tar
  1159. }
  1160. ADD_YTEST($MODULE_PREFIX$REALPRJNAME $BOOST_TEST_TYPE_STRING)
  1161. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1162. _DONT_REQUIRE_LICENSE()
  1163. }
  1164. # tag:deprecated
  1165. ### @usage BOOSTTEST_WITH_MAIN([name]) #deprecated
  1166. ###
  1167. ### Same as BOOSTTEST (see above), but comes with builtin int main(argc, argv) implementation
  1168. module BOOSTTEST_WITH_MAIN: BOOSTTEST {
  1169. PEERDIR(library/cpp/testing/boost_test_main)
  1170. }
  1171. FUZZ_DICTS_VALUE=
  1172. ### @usage: FUZZ_DICTS(path1 [path2...])
  1173. ###
  1174. ### Allows you to specify dictionaries, relative to the root of Arcadia, which will be used in Fuzzing.
  1175. ### Libfuzzer and AFL use a single syntax for dictionary descriptions.
  1176. ### Should only be used in FUZZ modules.
  1177. ###
  1178. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1179. macro FUZZ_DICTS(Data...) {
  1180. SET_APPEND(FUZZ_DICTS_VALUE $Data)
  1181. }
  1182. FUZZ_OPTS_VALUE=
  1183. ### @usage: FUZZ_OPTS(opt1 [Opt2...])
  1184. ###
  1185. ### Overrides or adds options to the corpus mining and fuzzer run.
  1186. ### Currently supported only Libfuzzer, so you should use the options for it.
  1187. ### Should only be used in FUZZ modules.
  1188. ###
  1189. ### @example:
  1190. ###
  1191. ### FUZZ_OPTS (
  1192. ### -max_len=1024
  1193. ### -rss_limit_mb=8192
  1194. ### )
  1195. ###
  1196. ### Documentation: https://wiki.yandex-team.ru/yatool/fuzzing/
  1197. macro FUZZ_OPTS(Data...) {
  1198. SET_APPEND(FUZZ_OPTS_VALUE $Data)
  1199. }
  1200. # tag:yt-specific tag:test
  1201. TEST_YT_SPEC_VALUE=
  1202. ### @usage: YT_SPEC(path1 [path2...])
  1203. ###
  1204. ### Allows you to specify json-files with YT task and operation specs,
  1205. ### which will be used to run test node in the YT.
  1206. ### Test must be marked with ya:yt tag.
  1207. ### Files must be relative to the root of Arcadia.
  1208. ###
  1209. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  1210. macro YT_SPEC(Data...) {
  1211. SET_APPEND(TEST_YT_SPEC_VALUE $Data)
  1212. }
  1213. # tag:test
  1214. TEST_SRCS_VALUE=
  1215. ### @usage: TEST_SRCS(Files...)
  1216. ###
  1217. ### In PY2TEST, PY3TEST and PY*_LIBRARY modules used as PY_SRCS macro and additionally used to mine test cases to be executed by testing framework.
  1218. ###
  1219. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#testynapytest
  1220. macro TEST_SRCS(Tests...) {
  1221. SET_APPEND(TEST_SRCS_VALUE $Tests)
  1222. }
  1223. macro DISABLE_DATA_VALIDATION() {
  1224. DISABLE(VALIDATE_DATA)
  1225. }
  1226. # tag:test
  1227. TEST_DATA_VALUE=
  1228. ### @usage: DATA([path...])
  1229. ###
  1230. ### Specifies the path to the data necessary test.
  1231. ### Valid values are: arcadia/<path> , arcadia_tests_data/<path> and sbr://<resource_id>.
  1232. ### In the latter case resource will be brought to the working directory of the test before it is started
  1233. ###
  1234. ### Used only inside TEST modules.
  1235. ###
  1236. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#dannyeizrepozitorija
  1237. macro DATA(Data...) {
  1238. SET_APPEND(TEST_DATA_VALUE $Data)
  1239. ADD_CHECK(check.data $Data)
  1240. }
  1241. # tag:test
  1242. ### @usage: DATA_FILES([path...])
  1243. ###
  1244. ### Specifies the path to the arcadia source data necessary test.
  1245. ### Used only inside TEST modules.
  1246. ###
  1247. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#dannyeizrepozitorija
  1248. macro DATA_FILES(Paths...) {
  1249. SET_APPEND(TEST_DATA_VALUE ${pre=arcadia/:Paths})
  1250. _DATA_FILES($Paths)
  1251. }
  1252. # tag:test
  1253. ### @usage: EXPLICIT_DATA()
  1254. ###
  1255. ### Disables implicit macro DATA(<module_path>).
  1256. ADD_SRCDIR_TO_TEST_DATA=yes
  1257. macro EXPLICIT_DATA() {
  1258. SET(ADD_SRCDIR_TO_TEST_DATA no)
  1259. }
  1260. # tag:test
  1261. TEST_TAGS_VALUE=
  1262. ### @usage: TAG ([tag...])
  1263. ###
  1264. ### Each test can have one or more tags used to filter tests list for running.
  1265. ### There are also special tags affecting test behaviour, for example ya:external, sb:ssd.
  1266. ###
  1267. ### Documentation: https://wiki.yandex-team.ru/yatool/test/#obshhieponjatija
  1268. macro TAG(Tags...) {
  1269. SET_APPEND(TEST_TAGS_VALUE $Tags)
  1270. }
  1271. # tag:test
  1272. TEST_REQUIREMENTS_VALUE=
  1273. ### @usage: REQUIREMENTS([cpu:<count>] [disk_usage:<size>] [ram:<size>] [ram_disk:<size>] [container:<id>] [network:<restricted|full>] [dns:dns64])
  1274. ###
  1275. ### Allows you to specify the requirements of the test.
  1276. ###
  1277. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  1278. macro REQUIREMENTS(Tags...) {
  1279. SET_APPEND(TEST_REQUIREMENTS_VALUE $Tags)
  1280. }
  1281. # tag:test
  1282. TEST_ENV_VALUE=
  1283. ### @usage: ENV(key[=value])
  1284. ###
  1285. ### Sets env variable key to value (gets value from system env by default).
  1286. macro ENV(Data...) {
  1287. SET_APPEND(TEST_ENV_VALUE ${quo:Data})
  1288. }
  1289. ### @usage: CONFTEST_LOAD_POLICY_LOCAL()
  1290. ###
  1291. ### Loads conftest.py files in a way that pytest does it
  1292. macro CONFTEST_LOAD_POLICY_LOCAL() {
  1293. SET_APPEND(TEST_ENV_VALUE "CONFTEST_LOAD_POLICY=LOCAL")
  1294. }
  1295. # tag:test
  1296. TEST_RECIPES_VALUE=
  1297. ### @usage: USE_RECIPE(path [arg1 arg2...])
  1298. ###
  1299. ### Provides prepared environment via recipe for test.
  1300. ###
  1301. ### Documentation: https://wiki.yandex-team.ru/yatool/test/recipes
  1302. macro USE_RECIPE(Data...) {
  1303. SET_APPEND(TEST_RECIPES_VALUE $Data)
  1304. SET_APPEND(TEST_RECIPES_VALUE "USE_RECIPE_DELIM")
  1305. }
  1306. # tag:python-specific tag:test
  1307. TEST_PYTHON_PATH_VALUE=
  1308. # tag:python-specific tag:test
  1309. ### @usage: PYTHON_PATH(Path)
  1310. ###
  1311. ### Set path to Python that will be used to runs scripts in tests
  1312. macro PYTHON_PATH(Path) {
  1313. SET(TEST_PYTHON_PATH_VALUE $Path)
  1314. }
  1315. # tag:test
  1316. SKIP_TEST_VALUE=
  1317. ### @usage: SKIP_TEST(Reason)
  1318. ###
  1319. ### Skip the suite defined by test module. Provide a reason to be output in test execution report.
  1320. macro SKIP_TEST(Reason...) {
  1321. SET(SKIP_TEST_VALUE $Reason)
  1322. }
  1323. # tag:test
  1324. LINT_LEVEL_VALUE=extended
  1325. _NO_LINT_VALUE=
  1326. ### @usage: NO_LINT([ktlint])
  1327. ###
  1328. ### Do not check for style files included in PY_SRCS, TEST_SRCS, JAVA_SRCS.
  1329. ### Ktlint can be disabled using NO_LINT(ktlint) explicitly.
  1330. macro NO_LINT(ktlint?"ktlint":"none") {
  1331. SET(_NO_LINT_VALUE ${ktlint})
  1332. }
  1333. ### @usage: LINT(<none|base|strict>)
  1334. ###
  1335. ### Set linting level for sources of the module
  1336. macro LINT(level) {
  1337. SET(LINT_LEVEL_VALUE $level)
  1338. }
  1339. # tag:cpp-specific tag:test
  1340. module CPP_STYLE_TEST_14: PY3TEST_BIN {
  1341. DEPENDS(contrib/libs/clang14/tools/clang-format)
  1342. PEERDIR+=library/python/cpp_test
  1343. }
  1344. macro STYLE(Globs...) {
  1345. _GLOB(STYLE_SRCS_GLOB ${pre=${ARCADIA_ROOT}:Globs})
  1346. _STYLE(${STYLE_SRCS_GLOB})
  1347. }
  1348. # tag:test
  1349. ### @usage: EXECTEST()
  1350. ###
  1351. ### Module definition of generic test that executes a binary.
  1352. ### Use macro RUN to specify binary to run.
  1353. ###
  1354. ### @example:
  1355. ###
  1356. ### EXECTEST()
  1357. ### OWNER(g:yatool)
  1358. ###
  1359. ### RUN(
  1360. ### cat input.txt
  1361. ### )
  1362. ### DATA(
  1363. ### arcadia/devtools/ya/test/tests/exectest/data
  1364. ### )
  1365. ### DEPENDS(
  1366. ### devtools/dummy_arcadia/cat
  1367. ### )
  1368. ### TEST_CWD(devtools/ya/test/tests/exectest/data)
  1369. ### END()
  1370. ###
  1371. ### More examples: https://wiki.yandex-team.ru/yatool/test/#exec-testy
  1372. ###
  1373. ### @see: [RUN()](#macro_RUN)
  1374. module EXECTEST: _BARE_UNIT {
  1375. .NODE_TYPE=Program
  1376. .FINAL_TARGET=no
  1377. .ALLOWED=YT_SPEC
  1378. .RESTRICTED=FORK_TEST_FILES
  1379. .DEFAULT_NAME_GENERATOR=FullPath
  1380. .ARGS_PARSER=Base
  1381. SET(MODULE_SUFFIX .pkg.fake)
  1382. SETUP_EXECTEST()
  1383. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS canondata/result.json)
  1384. }
  1385. # tag:cpp-specific tag:test
  1386. ### @usage: Y_BENCHMARK([benchmarkname])
  1387. ###
  1388. ### Benchmark test based on the library/cpp/testing/benchmark.
  1389. ###
  1390. ### For more details see: https://wiki.yandex-team.ru/yatool/test/#zapuskbenchmark
  1391. module Y_BENCHMARK: PROGRAM {
  1392. .SEM=CPP_PROGRAM_SEM
  1393. PEERDIR(library/cpp/testing/benchmark/main)
  1394. }
  1395. GBENCH_SEM=$CPP_PROGRAM_SEM \
  1396. && add_test NAME $REALPRJNAME COMMAND $REALPRJNAME \
  1397. && set_property TEST $REALPRJNAME PROPERTY LABELS SMALL $FILTER_ONLY_TEST_TAGS \
  1398. && add_test_requirements $REALPRJNAME $DEFAULT_REQUIREMENTS $TEST_REQUIREMENTS_VALUE \
  1399. $_TEST_TIMEOUT_SEM
  1400. # tag:cpp-specific tag:test
  1401. ### @usage: G_BENCHMARK([benchmarkname])
  1402. ###
  1403. ### Benchmark test based on the google benchmark.
  1404. ###
  1405. ### For more details see: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/benchmark/README.md
  1406. module G_BENCHMARK: _BASE_PROGRAM {
  1407. .SEM=GBENCH_SEM
  1408. .ALLOWED=YT_SPEC
  1409. PEERDIR(library/cpp/testing/gbenchmark)
  1410. ADD_YTEST($MODULE_PREFIX$REALPRJNAME g_benchmark)
  1411. }
  1412. BENCHMARK_OPTS_VALUE=
  1413. ### @usage: BENCHMARK_OPTS(opt1 [opt2...])
  1414. ###
  1415. ### Allows to specify extra args to benchmark binary.
  1416. ### Supported for G_BENCHMARK and Y_BENCHMARK
  1417. ###
  1418. ### @example:
  1419. ### BENCHMARK_OPTS (
  1420. ### --benchmark_min_time=0
  1421. ### )
  1422. ###
  1423. ### Documentation: https://docs.yandex-team.ru/ya-make/manual/tests/benchmark
  1424. macro BENCHMARK_OPTS(Data...) {
  1425. SET_APPEND(BENCHMARK_OPTS_VALUE $Data)
  1426. }
  1427. # tag:test
  1428. TEST_ROOT=$(TESTS_DATA_ROOT)
  1429. RESULT_MAX_FILE=0
  1430. STRIP_FILES=--dont-strip-files
  1431. VERIFY_RESULTS=--verify-results
  1432. ADDITIONAL_PATH=
  1433. # set for tests variables to fill it by YA_DEV or YA
  1434. YA_ROOT=ya
  1435. when ($YA_DEV == "yes") {
  1436. YA_ROOT=ya-dev
  1437. }
  1438. # tag:test
  1439. ### @usage: UNITTEST_FOR(path/to/lib)
  1440. ###
  1441. ### Convenience extension of UNITTEST module.
  1442. ### The UNINTTEST module with additional SRCDIR + ADDINCL + PEERDIR on path/to/lib.
  1443. ### path/to/lib is the path to the directory with the LIBRARY project.
  1444. ###
  1445. ### Documentation about the Arcadia test system: https://wiki.yandex-team.ru/yatool/test/
  1446. module UNITTEST_FOR: UNITTEST {
  1447. .SEM=UNITTEST_SEM
  1448. PEERDIR(ADDINCL $UNITTEST_DIR)
  1449. SRCDIR($UNITTEST_DIR)
  1450. }
  1451. ### @usage: _LIBRARY # internal
  1452. ###
  1453. ### Base module definition for all libraries.
  1454. ### Contains basic logic like module properties, default variable values etc.
  1455. ### All libraries similar to C++-libraries should be inherited from it.
  1456. module _LIBRARY: _BASE_UNIT {
  1457. .CMD=LINK_LIB
  1458. .NODE_TYPE=Library
  1459. .PEERDIR_POLICY=as_include
  1460. .EXTS=.o .obj .a .mf .supp .tidyjson .ld .lib
  1461. .ALLOWED=GRPC USE_SKIFF EXTRALIBS OBJADDE_GLOBAL RESOURCE_FILES
  1462. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS SRCS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  1463. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SPLIT_DWARF
  1464. .FINAL_TARGET=no
  1465. .GLOBAL_CMD=GLOBAL_LINK_LIB
  1466. .GLOBAL_EXTS=.o .obj .tidyjson
  1467. GLOBAL_SUFFIX=.global$MODULE_SUFFIX
  1468. #TODO: Remove this hack (really we do not need add fake src at all)
  1469. ENABLE(NEED_ADD_FAKE_SRC)
  1470. CHECK_CONTRIB_CREDITS(contrib/clickhouse contrib/libs contrib/deprecated EXCEPT contrib/deprecated/python)
  1471. when ($USE_MKL == "yes") {
  1472. NOPLATFORM=yes
  1473. }
  1474. when ($MSVC == "yes" || $CYGWIN == "yes") {
  1475. MODULE_PREFIX=
  1476. MODULE_SUFFIX=.lib
  1477. }
  1478. otherwise {
  1479. when ($TIDY_ENABLED == "yes") {
  1480. MODULE_PREFIX=
  1481. MODULE_SUFFIX=.tidyjson
  1482. }
  1483. otherwise {
  1484. MODULE_PREFIX=lib
  1485. MODULE_SUFFIX=.a
  1486. }
  1487. }
  1488. when ($WERROR != "no") {
  1489. when ($WERROR_MODE == "all" || ($WERROR_MODE == "compiler_specific" && $WERROR == "yes")) {
  1490. C_WARNING_OPTS += $WERROR_FLAG
  1491. }
  1492. }
  1493. when ($WITH_VALGRIND == "yes") {
  1494. PEERDIR+=contrib/libs/valgrind
  1495. # https://st.yandex-team.ru/DTCC-1227
  1496. CFLAGS+=-fdebug-default-version=4
  1497. }
  1498. when ($USE_ARCADIA_LIBM == "yes") {
  1499. PEERDIR+=contrib/libs/libm
  1500. }
  1501. }
  1502. CPP_LIBRARY_INDUCED_SEM_PROPERTY=consumer_link_library
  1503. CPP_LIBRARY_SEM=add_library ${MODDIR} $CMAKE_TARGET_NAME ${hide:TARGET} ${hide:AUTO_INPUT} $CMAKE_TARGET_ARTEFACT_RENAME_RULES \
  1504. && library_fake_marker FAKE_MODULE ${FAKE_MODULE} \
  1505. && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET \
  1506. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  1507. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  1508. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  1509. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW \
  1510. && target_link_options INTERFACE $LDFLAGS_GLOBAL_RAW \
  1511. && add_language C && add_language CXX
  1512. CPP_OBJ_LIBRARY_SEM=add_global_library_for ${MODDIR} ${suf=.global:CMAKE_TARGET_NAME} $CMAKE_TARGET_NAME ${hide:GLOBAL_TARGET} ${hide:AUTO_INPUT} \
  1513. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  1514. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  1515. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  1516. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW
  1517. CMAKE_FIND_PKG=
  1518. CMAKE_LINK_TARGET=$REALPRJNAME
  1519. CMAKE_FIND_PKG_COMP=
  1520. CONAN_REQUIRE=
  1521. CONAN_OPTS_SEM=
  1522. ### @usage: LIBRARY()
  1523. ###
  1524. ### The regular static library module.
  1525. ###
  1526. ### The LIBRARY() is intermediate module, so when built directly it won't build its dependencies.
  1527. ### It transitively provides its PEERDIRs to ultimate final target, where all LIBRARY() modules are built and linked together.
  1528. ###
  1529. ### This is C++ library, and it selects peers from multimodules accordingly.
  1530. ###
  1531. ### It makes little sense to mention LIBRARY in DEPENDS or BUNDLE, package and deploy it since it is not a standalone entity.
  1532. ### In order to use library in tests PEERDIR it to link into tests.
  1533. ### If you think you need to distribute static library please contact devtools@ for assistance.
  1534. module LIBRARY: _LIBRARY {
  1535. .GLOBAL=_AARS _PROGUARD_RULES
  1536. .SEM=CPP_LIBRARY_SEM
  1537. .GLOBAL_SEM=CPP_OBJ_LIBRARY_SEM
  1538. .DEFAULT_NAME_GENERATOR=ThreeDirNames
  1539. .ARGS_PARSER=Base
  1540. when ($CMAKE_PACKAGE_COMPONENT != "") {
  1541. CMAKE_FIND_PKG_COMP=COMPONENTS $CMAKE_PACKAGE_COMPONENT
  1542. }
  1543. when ($CMAKE_PACKAGE != "") {
  1544. CMAKE_FIND_PKG=find_package $CMAKE_PACKAGE $CMAKE_FIND_PKG_COMP
  1545. CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  1546. }
  1547. when ($CONAN_REFERENCE != "") {
  1548. CONAN_REQUIRE=&& conan_require $CONAN_REFERENCE
  1549. CPP_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  1550. }
  1551. when ($CONAN_PKG_OPTS != "") {
  1552. CONAN_OPTS_SEM=&& conan_options $CONAN_PKG_OPTS
  1553. }
  1554. when ($OPENSOURCE_EXPORT == "no") {
  1555. CPP_LIBRARY_SEM=IGNORED
  1556. }
  1557. when ($HAS_CPP_PROTOBUF_PEERS == "yes") {
  1558. PEERDIR+=$CPP_PROTOBUF_PEERS
  1559. }
  1560. SET(MODULE_TYPE LIBRARY)
  1561. SET(MODULE_LANG CPP)
  1562. ADD_CLANG_TIDY()
  1563. }
  1564. # tag:internal
  1565. ### @usage: _BARE_MODULE() # internal
  1566. ###
  1567. ### Remove unwanted dependencies for "empty" library module
  1568. macro _BARE_MODULE() {
  1569. SET(NEED_PLATFORM_PEERDIRS no)
  1570. SET(PEERDIR_TEST_TOOL no)
  1571. DISABLE(WITH_VALGRIND)
  1572. NO_CODENAVIGATION()
  1573. NO_PLATFORM()
  1574. NO_RUNTIME()
  1575. NO_UTIL()
  1576. NO_CLANG_TIDY()
  1577. }
  1578. # tag:internal
  1579. ### @usage: _BARE_LINK_MODULE() # internal
  1580. ###
  1581. ### Remove unwanted dependencies for "empty" link module
  1582. macro _BARE_LINK_MODULE() {
  1583. _BARE_MODULE()
  1584. DISABLE(COMMON_LINK_SETTINGS)
  1585. ALLOCATOR(FAKE)
  1586. }
  1587. # tag:internal
  1588. ### @usage: _CONDITIONAL_SRCS([USE_CONDITIONAL_SRCS] Files...) # internal
  1589. ###
  1590. ### Adds Files... to SRCS if first word is `USE_CONDITIONAL_SRCS`
  1591. ### To be used with some variable which is set to `USE_CONDITIONAL_SRCS` under condition
  1592. macro _CONDITIONAL_SRCS(USE_CONDITIONAL_SRCS[], DYMMY...) {
  1593. SRCS($USE_CONDITIONAL_SRCS)
  1594. }
  1595. # XXX: dirty hack for correct LDFLAGS passing
  1596. RESOURCES_LIBRARY_LINK=$TOUCH_UNIT
  1597. RESOURCES_LIBRARY_SEM=IGNORED
  1598. ### @usage: RESOURCES_LIBRARY()
  1599. ###
  1600. ### Definition of a module that brings its content from external source (Sandbox) via DECLARE_EXTERNAL_RESOURCE macro.
  1601. ### This can participate in PEERDIRs of others as library but it cannot have own sources and PEERDIRs.
  1602. ###
  1603. ### @see: [DECLARE_EXTERNAL_RESOURCE()](#macro_DECLARE_EXTERNAL_RESOURCE)
  1604. module RESOURCES_LIBRARY: _BARE_UNIT {
  1605. .CMD=RESOURCES_LIBRARY_LINK
  1606. .SEM=RESOURCES_LIBRARY_SEM
  1607. .ALLOWED=DECLARE_EXTERNAL_RESOURCE EXTRALIBS OBJADDE_GLOBAL
  1608. .RESTRICTED=ALLOCATOR SIZE TAG DATA TEST_DATA DEPENDS FORK_TESTS FORK_SUBTESTS SPLIT_FACTOR TEST_CWD RUN TIMEOUT SRC SRCS PEERDIR SPLIT_DWARF
  1609. .NODE_TYPE=Library
  1610. .PEERDIR_POLICY=as_include
  1611. .EXTS=.o .obj .a .mf .supp .tidyjson .ld .lib
  1612. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  1613. when ($CMAKE_PACKAGE_COMPONENT != "") {
  1614. CMAKE_FIND_PKG_COMP=COMPONENTS $CMAKE_PACKAGE_COMPONENT
  1615. }
  1616. when ($CMAKE_PACKAGE != "") {
  1617. CMAKE_FIND_PKG=find_package $CMAKE_PACKAGE $CMAKE_FIND_PKG_COMP
  1618. RESOURCES_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  1619. }
  1620. when ($CONAN_REFERENCE != "") {
  1621. CONAN_REQUIRE=&& conan_require $CONAN_REFERENCE
  1622. RESOURCES_LIBRARY_SEM=$CMAKE_FIND_PKG && ${CPP_LIBRARY_INDUCED_SEM_PROPERTY} PUBLIC $CMAKE_LINK_TARGET $CONAN_REQUIRE $CONAN_OPTS_SEM && IGNORED
  1623. }
  1624. when ($CONAN_PKG_OPTS != "") {
  1625. CONAN_OPTS_SEM=&& conan_options $CONAN_PKG_OPTS
  1626. }
  1627. MODULE_SUFFIX=.pkg.fake
  1628. ENABLE(NEED_ADD_FAKE_SRC)
  1629. WITHOUT_LICENSE_TEXTS()
  1630. }
  1631. FAT_OBJECT_SEM=add_fat_object ${MODDIR} ${CMAKE_TARGET_NAME} ${hide:TARGET} ${hide:AUTO_INPUT} ${CMAKE_TARGET_ARTEFACT_RENAME_RULES} \
  1632. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  1633. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  1634. && set_global_flags FAT_OBJECT_PREFIX ${MODULE_PREFIX} \
  1635. && set_global_flags FAT_OBJECT_SUFFIX ${MODULE_SUFFIX}
  1636. ### Do not turn visibility=hidden symbos into static symbos of partially linked object file
  1637. ###
  1638. ### Note: This variable do not have any effect on platforms other than MacOS and iOS.
  1639. KEEP_FAT_OBJECT_SYMBOLS=no
  1640. ### @usage: FAT_OBJECT()
  1641. ###
  1642. ### The "fat" object module. It will contain all its transitive dependencies reachable by PEERDIRs:
  1643. ### static libraries, local (from own SRCS) and global (from peers') object files.
  1644. ###
  1645. ### Designed for use in XCode projects for iOS.
  1646. module FAT_OBJECT: LIBRARY {
  1647. .ALLOWED=PACK_GLOBALS_IN_LIBRARY
  1648. .CMD=LINK_FAT_OBJECT
  1649. .SEM=FAT_OBJECT_SEM
  1650. .PEERDIR_POLICY=as_build_from
  1651. when ($MSVC == "yes" || $CYGWIN == "yes") {
  1652. MODULE_SUFFIX=.lib
  1653. }
  1654. otherwise {
  1655. MODULE_SUFFIX=.a
  1656. }
  1657. when (($OS_DARWIN == "yes" || $OS_IOS == "yes") && $KEEP_FAT_OBJECT_SYMBOLS == "yes") {
  1658. LDFLAGS_GLOBAL += -keep_private_externs
  1659. }
  1660. when ($OS_IOS == "yes" || $OS_ANDROID == "yes" || $MAPSMOBI_BUILD_TARGET == "yes") {
  1661. MODULE_LICENSES_RESTRICTION_TYPES = ALLOW_ONLY
  1662. MODULE_LICENSES_RESTRICTIONS = SERVICE REQUIRE_CITATION
  1663. }
  1664. # FIXME: This is weird legacy
  1665. when ($OS_ANDROID == "yes") {
  1666. MODULE_PREFIX=lib
  1667. }
  1668. otherwise {
  1669. MODULE_PREFIX=
  1670. }
  1671. _USE_LINKER()
  1672. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  1673. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  1674. DISABLE(NEED_ADD_FAKE_SRC)
  1675. SRCS(build/scripts/_fake_src.cpp)
  1676. }
  1677. RECURSIVE_LIBRARY_SEM=add_recursive_library ${MODDIR} ${CMAKE_TARGET_NAME} ${hide:TARGET} ${hide:AUTO_INPUT} ${CMAKE_TARGET_ARTEFACT_RENAME_RULES} \
  1678. && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL \
  1679. && target_include_directories PRIVATE $_C__INCLUDE_OWNED \
  1680. && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS \
  1681. && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW \
  1682. && target_link_options INTERFACE $LDFLAGS_GLOBAL_RAW
  1683. ### @usage: RECURSIVE_LIBRARY()
  1684. ###
  1685. ### The recursive ("fat") library module. It will contain all its transitive dependencies reachable by PEERDIRs:
  1686. ### from static libraries, local (from own SRCS) and global (from peers') object files.
  1687. ###
  1688. ### Designed for use in XCode projects for iOS.
  1689. module RECURSIVE_LIBRARY: LIBRARY {
  1690. .CMD=LINK_RECURSIVE_LIBRARY
  1691. .SEM=RECURSIVE_LIBRARY_SEM
  1692. .PEERDIR_POLICY=as_build_from
  1693. # This module requires at least one .o which is not subject to removal so just add _fake_src.cpp as SRCS
  1694. # ymake's handling of NEED_ADD_FAKE_SRC may insert arbitrary command, not necessarily compilation
  1695. DISABLE(NEED_ADD_FAKE_SRC)
  1696. SRCS(build/scripts/_fake_src.cpp)
  1697. }
  1698. _SONAME=
  1699. _EXPORT_SCRIPT_SEM=
  1700. _CLEAN_TEXTREL=
  1701. macro _ADD_DYNLYB_SEM(Libname) {
  1702. .SEM=add_shared_library ${MODDIR} ${Libname} ${hide:TARGET} ${hide:AUTO_INPUT} && target_include_directories PUBLIC $_C__INCLUDE_GLOBAL && target_include_directories PRIVATE $_C__INCLUDE_OWNED && target_compile_options PRIVATE $USER_CFLAGS $USER_CXXFLAGS $_SEM_EXTRA_CXX_FLAGS && target_compile_options PUBLIC $USER_CFLAGS_GLOBAL_RAW $USER_CXXFLAGS_GLOBAL_RAW && target_link_options PRIVATE $LDFLAGS_GLOBAL_RAW $LDFLAGS $OBJADDE_LIB $OBJADDE && ${VCS_INFO_SEM} $_EXPORT_SCRIPT_SEM
  1703. }
  1704. CPP_DYN_LIBRARY_SEM=$_ADD_DYNLYB_SEM($CMAKE_TARGET_NAME) $CMAKE_TARGET_ARTEFACT_RENAME_RULES
  1705. macro CLEAN_TEXTREL() {
  1706. SET(_CLEAN_TEXTREL yes)
  1707. }
  1708. ### @usage: DLL_UNIT # internal
  1709. ###
  1710. ### Base module for all dynamically linked libraries as final artifacts.
  1711. ### Contains all general logic for such kind of modules. Supports versioning and export files.
  1712. ### Cannot participate in linking to programs, intended to be used as final artifact (packaged and deployed).
  1713. module DLL_UNIT: _LINK_UNIT {
  1714. .CMD=LINK_DYN_LIB
  1715. .SEM=CPP_DYN_LIBRARY_SEM
  1716. .NODE_TYPE=Library
  1717. .SYMLINK_POLICY=SO
  1718. .GLOBAL=USER_CFLAGS USER_CXXFLAGS USER_CONLYFLAGS LDFLAGS _WHOLE_ARCHIVE_LIBS_VALUE RPATH
  1719. .ALLOWED=WHOLE_ARCHIVE
  1720. .DEFAULT_NAME_GENERATOR=TwoDirNames
  1721. .ARGS_PARSER=DLL
  1722. DYNAMIC_LINK=yes
  1723. ALLOCATOR(FAKE)
  1724. SET(MODULE_TYPE DLL)
  1725. SET(MODULE_TAG DLL)
  1726. SET(MODULE_LANG CPP)
  1727. ADD_CLANG_TIDY()
  1728. when ($EXPORTS_FILE) {
  1729. _EXPORT_SCRIPT_SEM=&& use_export_script ${input:EXPORTS_FILE}
  1730. }
  1731. when ($MSVC == "yes" || $CYGWIN == "yes") {
  1732. MODULE_SUFFIX=.dll
  1733. }
  1734. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  1735. MODULE_PREFIX=lib
  1736. MODULE_SUFFIX=.dylib
  1737. }
  1738. elsewhen ($TIDY_ENABLED == "yes") {
  1739. MODULE_PREFIX=
  1740. MODULE_SUFFIX=.tidyjson
  1741. }
  1742. otherwise {
  1743. MODULE_PREFIX=lib
  1744. MODULE_SUFFIX=.so
  1745. }
  1746. # This by now replicates ymake's behavior. We'll get rid of SONAME setting in ymake and fix this code altogether
  1747. SONAME=${pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX:REALPRJNAME}
  1748. when ($MODULE_VERSION) {
  1749. LINK_DYN_LIB_FLAGS=--soname ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION:REALPRJNAME}
  1750. }
  1751. _SONAME=$SONAME$MODULE_VERSION
  1752. when ($LINUX == "yes") {
  1753. # '-z notext' is needed for linking mkl into shared libraries
  1754. when ($_CLEAN_TEXTREL != "yes") {
  1755. LDFLAGS += -Wl,-z,notext
  1756. }
  1757. }
  1758. when ($OS_LINUX == "yes" && $ARCH_X86_64 == "yes") {
  1759. when ($_NO_FIX_ELF != "yes") {
  1760. LINK_DYN_LIB_FLAGS+=--fix-elf ${tool:"tools/fix_elf"}
  1761. }
  1762. }
  1763. when ($DARWIN == "yes") {
  1764. LDFLAGS += -undefined dynamic_lookup
  1765. }
  1766. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no") {
  1767. PEERDIR+=library/cpp/testing/dump_clang_coverage
  1768. }
  1769. when ($IDE_MSVS == "yes") {
  1770. PEERDIR+=build/scripts/c_templates
  1771. }
  1772. when ($_CUSTOM_LINK_STEP_SCRIPT) {
  1773. LINK_DYN_LIB_FLAGS+=--python=$YMAKE_PYTHON --custom-step=${input:_CUSTOM_LINK_STEP_SCRIPT}
  1774. }
  1775. }
  1776. # tag:r-specific
  1777. ### @usage: R_MODULE(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  1778. ###
  1779. ### The external module for R language.
  1780. ### 1. major_ver and minor_ver must be integers.
  1781. ### 2. The resulting .so will have the prefix "lib".
  1782. ### 3. Processing EXPORTS and PREFIX is the same as for DLL module
  1783. ### This is native DLL, so it will select C++ version from PROTO_LIBRARY.
  1784. module R_MODULE: DLL_UNIT {
  1785. .SEM=CPP_DYN_LIBRARY_SEM
  1786. when ($DARWIN == "yes") {
  1787. LDFLAGS+=-flat_namespace -dynamiclib
  1788. }
  1789. when ($MSVC == "yes" || $CYGWIN == "yes") {
  1790. MODULE_PREFIX=lib
  1791. MODULE_SUFFIX=.dll
  1792. }
  1793. ADDINCL(contrib/libs/r-lang)
  1794. }
  1795. ### @usage: DYNAMIC_LIBRARY_FROM(Paths)
  1796. ###
  1797. ### Use specified libraries as sources of DLL
  1798. macro DYNAMIC_LIBRARY_FROM(Path...) {
  1799. PEERDIR($Path)
  1800. WHOLE_ARCHIVE($Path)
  1801. }
  1802. ### @usage: DLL(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  1803. ###
  1804. ### Dynamic library module definition.
  1805. ### 1. major_ver and minor_ver must be integers.
  1806. ### 2. EXPORTS allows you to explicitly specify the list of exported functions. This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files
  1807. ### 3. PREFIX allows you to change the prefix of the output file (default DLL has the prefix "lib").
  1808. ###
  1809. ### DLL cannot participate in linking to programs but can be used from Java or as final artifact (packaged and deployed).
  1810. module DLL: DLL_UNIT {
  1811. .SEM=CPP_DYN_LIBRARY_SEM
  1812. SET(MAKE_ONLY_SHARED_LIB yes)
  1813. when ($OS_WINDOWS) {
  1814. MODULE_SUFFIX=.dll
  1815. }
  1816. # TODO: Make it possible to use this syntax
  1817. # DEFAULT(DLL_FOR_DIR no)
  1818. ### FIXME: XXX
  1819. ###when ($DLL_FOR_DIR != "no") {
  1820. ### SRCDIR($DLL_FOR_DIR)
  1821. ### ADDINCL($DLL_FOR_DIR)
  1822. ###}
  1823. }
  1824. ### DLL_TOOL is a DLL that can be used as a LD_PRELOAD tool.
  1825. module DLL_TOOL: DLL {
  1826. .SEM=CPP_DYN_LIBRARY_SEM
  1827. # ymake resolves only program nodes as tools.
  1828. .NODE_TYPE=Program
  1829. }
  1830. ### @usage: SO_PROGRAM(name major_ver [minor_ver] [EXPORTS symlist_file] [PREFIX prefix])
  1831. ###
  1832. ### Executable dynamic library module definition.
  1833. ### 1. major_ver and minor_ver must be integers.
  1834. ### 2. EXPORTS allows you to explicitly specify the list of exported functions. This accepts 2 kind of files: .exports with <lang symbol> pairs and JSON-line .symlist files
  1835. ### 3. PREFIX allows you to change the prefix of the output file.
  1836. module SO_PROGRAM: DLL {
  1837. .CMD=LINK_EXEC_DYN_LIB
  1838. SET(MODULE_TYPE PROGRAM)
  1839. MODULE_PREFIX=
  1840. when ($MSVC == "yes" || $CYGWIN == "yes") {
  1841. MODULE_SUFFIX=.exe
  1842. }
  1843. otherwise {
  1844. MODULE_SUFFIX=
  1845. }
  1846. }
  1847. DLL_PROXY_CMD_MF=$GENERATE_MF && $COPY_CMD $AUTO_INPUT $TARGET
  1848. # tag:internal
  1849. ### @usage: DEV_DLL_PROXY() # internal
  1850. ###
  1851. ### The use of this module is strictly prohibited!!!
  1852. ### This is a temporary and project-specific solution.
  1853. module DEV_DLL_PROXY: _BARE_UNIT {
  1854. .NODE_TYPE=Library
  1855. .EXTS=.so .dll .dylib .mf
  1856. .CMD=DLL_PROXY_CMD_MF
  1857. DYNAMIC_LINK=yes
  1858. when ($OS_WINDOWS == "yes") {
  1859. MODULE_SUFFIX=.dll
  1860. }
  1861. elsewhen ($DARWIN == "yes" || $OS_IOS == "yes") {
  1862. MODULE_PREFIX=lib
  1863. MODULE_SUFFIX=.dylib$MODULE_VERSION
  1864. }
  1865. otherwise {
  1866. MODULE_PREFIX=lib
  1867. MODULE_SUFFIX=.so$MODULE_VERSION
  1868. }
  1869. }
  1870. # tag:internal
  1871. ### @usage: DYNAMIC_DEPS(Path...) # internal, temporary
  1872. ###
  1873. ### Enlist paths to all DYNAMIC_LIBRARY dependencies of the DYNAMIC_LIBRARY
  1874. ### This it needed to transfer their outputs through the library to PROGRAM
  1875. ### or dependent DLL/DYNAMIC_LIBRARY.
  1876. ###
  1877. ### Note: this is temporary solution until support of `super-global` variables come
  1878. ### which will enable transfer of some properties though final targets like DLLs.
  1879. macro DYNAMIC_DEPS(Path...) {
  1880. # PEERDIR as macro completely ignored in place where this macro applies
  1881. SET_APPEND(PEERDIR $Path)
  1882. }
  1883. # tag:internal
  1884. ### @usage: DYNAMIC_LIBRARY() # internal
  1885. ###
  1886. ### The use of this module is strictly prohibited except LGPL-related opensourcing
  1887. ### This provides linkable DLL module which brings its results to programs and tests
  1888. ### for seamless testing and packaging
  1889. multimodule DYNAMIC_LIBRARY {
  1890. module DLL_BIN: DLL {
  1891. .PROXY=yes
  1892. .IGNORED=PROVIDES
  1893. SET(MODULE_TAG DLL)
  1894. }
  1895. module DLL_LIB: _DLL_COMPATIBLE_LIBRARY {
  1896. .CMD=TOUCH_UNIT_MF
  1897. .PEERDIRSELF=DLL_BIN
  1898. .IGNORED=SRCS PEERDIR RUN_PROGRAM PYTHON DYNAMIC_LIBRARY_FROM GENERATE_ENUM_SERIALIZATION GENERATE_ENUM_SERIALIZATION_WITH_HEADER USE_PYTHON2 USE_PYTHON3
  1899. .ALLOWED=DYNAMIC_DEPS
  1900. SET(PEERDIR_TAGS DLL_LIB __EMPTY__)
  1901. _BARE_MODULE()
  1902. DYNAMIC_LINK=yes
  1903. MODULE_SUFFIX=.pkg.fake
  1904. PEERDIR+=build/platform/local_so
  1905. # disable credits generation for static library
  1906. SET(CREDITS_FLAGS)
  1907. }
  1908. }
  1909. ### @usage: GLOBAL_SRCS(filenames...)
  1910. ###
  1911. ### Make all source files listed as GLOBAL.
  1912. ### Call to GLOBAL_SRCS macro is equivalent to call to SRCS macro when each source file is marked with GLOBAL keyword.
  1913. ### Arcadia root relative or project dir relative paths are supported for filenames arguments. GLOBAL keyword is not
  1914. ### recognized for GLOBAL_SRCS in contrast to SRCS macro.
  1915. ###
  1916. ### @example:
  1917. ### Consider the file to ya.make:
  1918. ###
  1919. ### LIBRARY()
  1920. ### GLOBAL_SRCS(foo.cpp bar.cpp)
  1921. ### END()
  1922. ###
  1923. ### @see: [SRCS()](#macro_SRCS)
  1924. macro GLOBAL_SRCS(Files...) {
  1925. SRCS(${pre=GLOBAL :Files})
  1926. }
  1927. ### @usage: ALL_SRCS([GLOBAL] filenames...)
  1928. ###
  1929. ### Make all source files listed as GLOBAL or not depending on the keyword GLOBAL
  1930. ### Call to ALL_SRCS macro is equivalent to call to GLOBAL_SRCS macro when GLOBAL keyword is specified
  1931. ### as the first argument and is equivalent to call to SRCS macro otherwise.
  1932. ###
  1933. ### @example:
  1934. ###
  1935. ### LIBRARY()
  1936. ### SET(MAKE_IT_GLOBAL GLOBAL)
  1937. ### ALL_SRCS(${MAKE_IT_GLOBAL} foo.cpp bar.cpp)
  1938. ### END()
  1939. ###
  1940. ### @see: [GLOBAL_SRCS()](#macro_GLOBAL_SRCS), [SRCS()](#macro_SRCS)
  1941. macro ALL_SRCS(GLOBAL?"GLOBAL":"", Files...) {
  1942. SRCS(${pre=$GLOBAL :Files})
  1943. }
  1944. ### @usage: _DLL_COMPATIBLE_LIBRARY # internal
  1945. ###
  1946. ### Base module to place DLLs into multimodules back to back with libraries.
  1947. ### In order to function properly all modules in multimodule shall have the
  1948. ### same set of arguments. So this module is just library that accepts but
  1949. ### ignores all DLL arguments.
  1950. module _DLL_COMPATIBLE_LIBRARY: LIBRARY {
  1951. .DEFAULT_NAME_GENERATOR=TwoDirNames
  1952. .ARGS_PARSER=DLL
  1953. }
  1954. # as SRCS in packages use macro BUNDLE_SRCS!
  1955. PACKED_PACKAGE_ARGS=
  1956. PACKED_PACKAGE_EXT=
  1957. ### @usage: PACK(archive_type)
  1958. ###
  1959. ### When placed inside the PACKAGE module, packs the build results tree to the archive with specified extension. Currently supported extensions are `tar` and `tar.gz`
  1960. ###
  1961. ### Is not allowed other module types than PACKAGE().
  1962. ###
  1963. ### @see: [PACKAGE()](#module_PACKAGE)
  1964. macro PACK(Ext) {
  1965. SET(PACKED_PACKAGE_EXT $Ext)
  1966. }
  1967. PACKAGE_STRICT_VALUE=
  1968. macro PACKAGE_STRICT() {
  1969. SET(PACKAGE_STRICT_VALUE yes)
  1970. }
  1971. ### @usage: PACKAGE(name)
  1972. ###
  1973. ### Module collects what is described directly inside it, builds and collects all its transitively available PEERDIRs.
  1974. ### As a result, build directory of the project gets the structure of the accessible part of Arcadia, where the build result of each PEERDIR is placed to relevant Arcadia subpath.
  1975. ### The data can be optionally packed if macro PACK() is used.
  1976. ###
  1977. ### Is only used together with the macros FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a PACKAGE.
  1978. ###
  1979. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  1980. ###
  1981. ### @see: [PACK()](#macro_PACK)
  1982. multimodule PACKAGE {
  1983. module PACKAGE_FINAL: _BASE_UNIT {
  1984. .CMD=TOUCH_PACKAGE_MF
  1985. .ALIASES=SRCS=FILES
  1986. .ALLOWED=PACK
  1987. .PEERDIRSELF=PACKAGE_UNION
  1988. .USE_PEERS_LATE_OUTS=yes
  1989. .PEERDIR_POLICY=as_build_from
  1990. .FINAL_TARGET=yes
  1991. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY2 PY3 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN PY3TEST_PROGRAM DLL GO_PROGRAM PACKAGE_UNION)
  1992. SET(MODULE_SUFFIX .final.pkg.fake)
  1993. SET(DONT_RESOLVE_INCLUDES yes)
  1994. NO_PLATFORM()
  1995. when ($PACKED_PACKAGE_EXT) {
  1996. PACKED_PACKAGE_ARGS+=--dest-arch ${output;pre=$MODULE_PREFIX;suf=.$PACKED_PACKAGE_EXT:REALPRJNAME}
  1997. }
  1998. SET(NEED_PLATFORM_PEERDIRS no)
  1999. }
  2000. module PACKAGE_UNION: UNION {
  2001. .CMD=UNION_CMD
  2002. .FINAL_TARGET=no
  2003. .ALLOWED=PACK
  2004. .IGNORED=VCS_INFO_FILE
  2005. SET(MODULE_SUFFIX .pkg.fake)
  2006. SET(PEERDIR_TAGS CPP_PROTO CPP_FBS PY2 PY3 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN PY3TEST_PROGRAM DLL GO_PROGRAM PACKAGE_UNION)
  2007. DISABLE(START_TARGET)
  2008. }
  2009. }
  2010. TOUCH_GROUP=$TOUCH_PACKAGE ${kv;hide:"p CI"}
  2011. ### @usage: CI_GROUP()
  2012. ###
  2013. ### Module collects what is described directly inside it transitively by PEERDIRs.
  2014. ### No particular layout of built artifacts is implied. This module is needed primarily for CI dependency analysis and may not trigger builds at all.
  2015. ###
  2016. ### Is only used together with the macro PEERDIR() and FILES(). Don't use SRCS inside CI_GROUP().
  2017. module CI_GROUP: _BARE_UNIT {
  2018. .CMD=TOUCH_GROUP
  2019. .PEERDIR_POLICY=as_build_from
  2020. .FINAL_TARGET=yes
  2021. .RESTRICTED=SRCS
  2022. .USE_PEERS_LATE_OUTS=yes
  2023. MODULE_SUFFIX=.ci.pkg.fake
  2024. PEERDIR_TAGS=CPP_PROTO PY3 PY3_NATIVE PY3_BIN PY3TEST_PROGRAM YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE DLL
  2025. }
  2026. # tag:generic tag:internal
  2027. TOUCH_UNIT_MF=$TOUCH_UNIT && $GENERATE_MF
  2028. ### @usage: UNION(name)
  2029. ###
  2030. ### Collection of PEERDIR dependencies, files and artifacts.
  2031. ### UNION doesn't build its peers, just provides those to modules depending on it.
  2032. ### When specified in DEPENDS() macro the UNION is transitively closed, building all its peers and providing those by own paths (without adding this module path like PACKAGE does).
  2033. ###
  2034. ### Is only used together with the macros like FILES(), PEERDIR(), COPY(), FROM_SANDBOX(), RUN_PROGRAM or BUNDLE(). Don't use SRCS inside a UNION.
  2035. ###
  2036. ### Documentation: https://wiki.yandex-team.ru/yatool/large-data/
  2037. module UNION: _BASE_UNIT {
  2038. .CMD=UNION_CMD_MF
  2039. .FINAL_TARGET=no
  2040. .ALIASES=SRCS=FILES
  2041. .ALLOWED=EXPLICIT_OUTPUTS
  2042. .IGNORED=VCS_INFO_FILE
  2043. NO_PLATFORM()
  2044. SET(MODULE_SUFFIX .pkg.fake)
  2045. SET(DONT_RESOLVE_INCLUDES yes)
  2046. SET(NEED_PLATFORM_PEERDIRS no)
  2047. PEERDIR_TAGS=CPP_PROTO CPP_FBS PY2 PY2_NATIVE YQL_UDF_SHARED __EMPTY__ DOCSBOOK JAR_RUNNABLE PY3_BIN DLL PACKAGE_UNION
  2048. UNION_OUTS=${hide;late_out:AUTO_INPUT}
  2049. when ($_UNION_EXPLICIT_OUTPUTS) {
  2050. UNION_OUTS=$_EXPAND_INS_OUTS($_UNION_EXPLICIT_OUTPUTS)
  2051. }
  2052. }
  2053. # tag:internal
  2054. ### @usage: _SET_FIRST_VALUE(name args...) # internal
  2055. ###
  2056. ### This macro sets the value of `name` variable to the value of next argument
  2057. macro _SET_FIRST_VALUE(NAME, VALUE, OTHER...) {
  2058. SET($NAME $VALUE)
  2059. }
  2060. # tag:internal
  2061. ### @usage: _SRCS_NO_GLOBAL(files...) # internal
  2062. ###
  2063. ### Proxy macro to SRCS macro which filters out GLOBAL keyword from the list of source files.
  2064. ### Useful for modules like EXTERNAL_JAVA_LIBRARY, where GLOBAL keyword cannot be applied properly.
  2065. ### Note: this macro changes order of source files.
  2066. macro _SRCS_NO_GLOBAL(GLOBAL[], FILES...) {
  2067. SRCS($GLOBAL $FILES)
  2068. }
  2069. @import "${CONF_ROOT}/conf/java.conf"
  2070. @import "${CONF_ROOT}/conf/python.conf"
  2071. TEST_CWD_VALUE=
  2072. ### @usage: TEST_CWD(path)
  2073. ###
  2074. ### Defines working directory for test runs. Often used in conjunction with DATA() macro.
  2075. ### Is only used inside of the TEST modules.
  2076. ###
  2077. ### Documentation: https://wiki.yandex-team.ru/yatool/test/
  2078. macro TEST_CWD(Arg) {
  2079. SET(TEST_CWD_VALUE $Arg)
  2080. }
  2081. # tag:allocator
  2082. ### @usage: ALLOCATOR(Alloc) # Default: LF
  2083. ###
  2084. ### Set memory allocator implementation for the PROGRAM()/DLL() module.
  2085. ### This may only be specified for programs and dlls, use in other modules leads to configuration errors.
  2086. ###
  2087. ### Available allocators are: "LF", "LF_YT", "LF_DBG", "YT", "J", "B", "BM", "C", "TCMALLOC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU", "PROFILED_HU", "THREAD_PROFILED_HU".
  2088. ### - LF - lfalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc)
  2089. ### - LF_YT - Allocator selection for YT (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/yt/ya.make)
  2090. ### - LF_DBG - Debug allocator selection (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/lfalloc/dbg/ya.make)
  2091. ### - YT - The YTAlloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/ytalloc/impl/ya.make)
  2092. ### - J - The JEMalloc allocator (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/jemalloc)
  2093. ### - B - The balloc allocator named Pyotr Popov and Anton Samokhvalov
  2094. ### - Discussion: https://ironpeter.at.yandex-team.ru/replies.xml?item_no=126
  2095. ### - Code: https://a.yandex-team.ru/arc/trunk/arcadia/library/cpp/balloc
  2096. ### - BM - The balloc for market (agri@ commits from july 2018 till November 2018 saved)
  2097. ### - C - Like B, but can be disabled for each thread to LF or SYSTEM one (B can be disabled only to SYSTEM)
  2098. ### - MIM - Microsoft's mimalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/mimalloc)
  2099. ### - TCMALLOC - Google TCMalloc (actual version) (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/tcmalloc)
  2100. ### - GOOGLE - Google TCMalloc (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/galloc)
  2101. ### - LOCKLESS - Allocator based upon lockless queues (https://a.yandex-team.ru/arc/trunk/arcadia/library/malloc/lockless)
  2102. ### - SYSTEM - Use target system allocator
  2103. ### - FAKE - Don't link with any allocator
  2104. ### - HU - Huge page allocator by @gulin.
  2105. ### - PROFILED_HU - patched HU. It is a bit slower but has metrics of memory consumption.
  2106. ### - THREAD_PROFILED_HU - patched (special for market) HU. It is a bit slower but has metrics of memory consumption.
  2107. ###
  2108. ### More about allocators in Arcadia: https://wiki.yandex-team.ru/arcadia/allocators/
  2109. macro ALLOCATOR(Alloc) {
  2110. SET(ALLOCATOR $Alloc)
  2111. when ($ALLOCATOR in [ "LF", "LF_YT", "LF_DBG", "YT", "YT_TCMALLOC", "YT_TCMALLOC_256K", "J", "B", "BM", "C", "TCMALLOC", "TCMALLOC_SMALL_BUT_SLOW", "TCMALLOC_NUMA_256K", "TCMALLOC_NUMA_LARGE_PAGES", "TCMALLOC_256K", "TCMALLOC_TC", "GOOGLE", "LOCKLESS", "SYSTEM", "FAKE", "MIM", "HU", "PROFILED_HU", "THREAD_PROFILED_HU" ]) {
  2112. }
  2113. otherwise {
  2114. PEERDIR+=___configure_error___unknown_allocator_type___$ALLOCATOR
  2115. }
  2116. }
  2117. when ($MIC_ARCH == "yes") {
  2118. CFLAGS+=-mmic
  2119. LDFLAGS+=-mmic
  2120. }
  2121. when ($USE_OPENMP == "yes") {
  2122. PEERDIR+=contrib/libs/openmp
  2123. }
  2124. when ($STRIP == "yes" && $NO_STRIP != "yes") {
  2125. STRIP_FLAG=$LD_STRIP_FLAG
  2126. DWARF_COMMAND=
  2127. GO_LINK_FLAGS_VALUE+=-s
  2128. }
  2129. when ($NO_LINKER_DCE != "yes") {
  2130. DCE_FLAG=$LD_DCE_FLAG
  2131. }
  2132. when ($BT_MINSIZEREL == "yes" || $LINKER_ICF == "yes") {
  2133. ICF_FLAG=$LD_ICF_FLAG
  2134. }
  2135. OBJCOPY_TOOL=$OBJCOPY_TOOL_VENDOR
  2136. OBJDUMP_TOOL=$OBJDUMP_TOOL_VENDOR
  2137. STRIP_TOOL=$STRIP_TOOL_VENDOR
  2138. NEED_BINUTILS_PEERDIR=
  2139. BINUTILS_USED=
  2140. when (!$OBJCOPY_TOOL_VENDOR) {
  2141. OBJCOPY_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/objcopy
  2142. NEED_BINUTILS_PEERDIR=yes
  2143. }
  2144. when (!$OBJDUMP_TOOL_VENDOR) {
  2145. OBJDUMP_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/objdump
  2146. NEED_BINUTILS_PEERDIR=yes
  2147. }
  2148. when (!$STRIP_TOOL_VENDOR) {
  2149. STRIP_TOOL=$BINUTILS_ROOT_RESOURCE_GLOBAL/bin/strip
  2150. NEED_BINUTILS_PEERDIR=yes
  2151. }
  2152. SPLIT_DWARF_VALUE=no
  2153. NO_SPLIT_DWARF=no
  2154. when ($OS_DARWIN || $OS_IOS || $OS_IOSSIM) {
  2155. SPLIT_DWARF_VALUE=yes
  2156. }
  2157. when ($STRIP_DEBUG_INFO) {
  2158. SPLIT_DWARF_VALUE=yes
  2159. NO_SPLIT_DWARF=no
  2160. }
  2161. ### @usage: SPLIT_DWARF()
  2162. ###
  2163. ### Emit debug info for the PROGRAM/DLL as a separate file <module_name>.debug.
  2164. ### NB: It does not help you to save process RSS but can add problems (see e.g. BEGEMOT-2147).
  2165. macro SPLIT_DWARF() {
  2166. SET(SPLIT_DWARF_VALUE yes)
  2167. }
  2168. ### @usage: NO_SPLIT_DWARF()
  2169. ###
  2170. ### Do NOT emit debug info for the PROGRAM/DLL as a separate file.
  2171. ### On macOS this also means do NOT generate dSym files (faster linkage)
  2172. macro NO_SPLIT_DWARF() {
  2173. SET(SPLIT_DWARF_VALUE no)
  2174. }
  2175. SPLIT_DWARF_OUTPUT=${output;tobindir;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.debug:REALPRJNAME}
  2176. when ($SPLIT_DWARF_VALUE == "yes" && $NO_SPLIT_DWARF != "yes" && $NO_DEBUGINFO != "yes" && $HOST_OS_LINUX == "yes" && $TARGET_PLATFORM == "LINUX") {
  2177. DWARF_COMMAND+= \
  2178. $OBJCOPY_TOOL --only-keep-debug $TARGET $SPLIT_DWARF_OUTPUT && \
  2179. $STRIP_TOOL --strip-debug $TARGET && \
  2180. $OBJCOPY_TOOL --remove-section=.gnu_debuglink --add-gnu-debuglink $SPLIT_DWARF_OUTPUT $TARGET
  2181. BINUTILS_USED=yes
  2182. }
  2183. ### @usage: EXTRALIBS_STATIC(Libs...)
  2184. ###
  2185. ### Add the specified external static libraries to the program link
  2186. macro EXTRALIBS_STATIC(Args...) {
  2187. LDFLAGS(-Wl,-Bstatic ${Args} -Wl,-Bdynamic)
  2188. }
  2189. ### @usage ADD_COMPILABLE_TRANSLATE(Dict Name Options...)
  2190. ###
  2191. ### Generate translation dictionary code to transdict.LOWER(Name).cpp that will than be compiled into library
  2192. macro ADD_COMPILABLE_TRANSLATE(Dict, Name, MakeTransDictOptions...) {
  2193. __translatename_lower=${tolower:Name}
  2194. __translate_dict=${BINDIR}/transdict.${__translatename_lower}.cpp
  2195. RUN_PROGRAM(dict/tools/maketransdict -i ${Dict} ${MakeTransDictOptions} ${Name} STDOUT_NOAUTO ${__translate_dict} IN ${Dict})
  2196. }
  2197. ### @usage ADD_COMPILABLE_TRANSLIT(TranslitTable NGrams Name Options...)
  2198. ###
  2199. ### Generate transliteration dictionary code
  2200. ### This will emit both translit, untranslit and ngrams table codes those will be than further compiled into library
  2201. macro ADD_COMPILABLE_TRANSLIT(TranslitTable, NGrams, Name, Options...) {
  2202. __translitname_lower=${tolower:Name}
  2203. __translit_table=${BINDIR}/translit_trie_${__translitname_lower}.cpp
  2204. __untranslit_table=${BINDIR}/untranslit_trie_${__translitname_lower}.cpp
  2205. __ngrams_table=${BINDIR}/ngr_arr_${__translitname_lower}.cpp
  2206. __gentrie_dir=dict/tools/make_untranslit_trie
  2207. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__untranslit_table})
  2208. RUN_PROGRAM(${__gentrie_dir} -i ${TranslitTable} -n ${Options} ${__translitname_lower} IN ${TranslitTable} STDOUT ${__translit_table})
  2209. RUN_PROGRAM(dict/tools/make_ngrams -i ${NGrams} ${Options} ${__translitname_lower} IN ${NGrams} STDOUT ${__ngrams_table})
  2210. }
  2211. macro _COPY_FILE_IMPL(FILE, AUTO_DST="", NOAUTO_DST="", OUTPUT_INCLUDES[], INDUCED_DEPS[], OUTPUT_INCLUDES_INP[]) {
  2212. .CMD=$COPY_CMD ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST} ${output_include;hide:OUTPUT_INCLUDES} ${output_include;from_input;hide:OUTPUT_INCLUDES_INP} $INDUCED_DEPS ${kv;hide:"p CP"} ${kv;hide:"pc light-cyan"}
  2213. .SEM=copy_file ${input:FILE} ${output:AUTO_DST} ${output;noauto:NOAUTO_DST}
  2214. }
  2215. ### @usage: COPY_FILE(File Destination [AUTO] [OUTPUT_INCLUDES Deps...])
  2216. ###
  2217. ### Copy file to build root. It is possible to change both location and the name.
  2218. ###
  2219. ### Parameters:
  2220. ### - File - Source file name.
  2221. ### - Destination - Output file name.
  2222. ### - AUTO - Consider copied file for further processing automatically.
  2223. ### - OUTPUT_INCLUDES output_includes... - Output file dependencies.
  2224. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  2225. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type)
  2226. ### and set of dependencies
  2227. ###
  2228. ### The file will be just copied if AUTO boolean parameter is not specified. You should explicitly
  2229. ### mention it in SRCS under new name (or specify AUTO boolean parameter) for further processing.
  2230. macro COPY_FILE(File, Destination, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  2231. .CMD=$_COPY_FILE_IMPL($File $AUTO $Destination OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
  2232. .SEM=$_COPY_FILE_IMPL($File $AUTO $Destination)
  2233. }
  2234. ### @usage: COPY_FILE_WITH_CONTEXT(FILE DEST [AUTO] [OUTPUT_INCLUDES DEPS...])
  2235. ###
  2236. ### Copy file to build root the same way as it is done for COPY_FILE, but also
  2237. ### propagates the context of the source file.
  2238. macro COPY_FILE_WITH_CONTEXT(FILE, DEST, AUTO?"AUTO_DST":"NOAUTO_DST", OUTPUT_INCLUDES[], INDUCED_DEPS[]) {
  2239. .CMD=$_COPY_FILE_IMPL($FILE $AUTO $DEST OUTPUT_INCLUDES_INP $FILE OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS)
  2240. }
  2241. ### This is to join $ALL_RES_ and $EXT
  2242. macro _ARF_HELPER(Args...) {
  2243. RESOURCE_FILES($Args)
  2244. }
  2245. ### @usage ALL_RESOURCE_FILES(Ext [PREFIX {prefix}] [STRIP {strip}] Dirs...)
  2246. ###
  2247. ### This macro collects all files with extension `Ext` and
  2248. ### Passes them to `RESOURCE_FILES` macro as relative to current directory
  2249. ###
  2250. ### `PREFIX` and `STRIP` have the same meaning as in `ROURCES_FILES`, both are applied over moddir-relative paths
  2251. ###
  2252. ### Note: This macro can be used multiple times per ya.make, but only once for each Ext value
  2253. ### Note: Wildcards are not allowed neither as Ext nor in Dirs
  2254. macro ALL_RESOURCE_FILES(EXT, PREFIX="", STRIP="", DIRS...) {
  2255. _GLOB(ALL_RES_$EXT ${suf=/*.$EXT:DIRS})
  2256. _ARF_HELPER(${pre=PREFIX :PREFIX} STRIP ${ARCADIA_ROOT}/${MODDIR}/${STRIP} ${pre=$ALL_RES_:EXT})
  2257. }
  2258. macro _BUNDLE_TARGET(Target, Destination) {
  2259. .CMD=$MOVE_FILE ${result:Target} ${output;noauto:Destination} ${kv;hide:"p BN"} ${kv;hide:"pc light-cyan"} $VCS_INFO_DISABLE_CACHE__NO_UID__
  2260. }
  2261. ### @usage: TIMEOUT(TIMEOUT)
  2262. ###
  2263. ### Sets a timeout on test execution
  2264. ###
  2265. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  2266. macro TIMEOUT(Time) {
  2267. SET(TEST_TIMEOUT $Time)
  2268. }
  2269. SBR_UID_EXT=""
  2270. # tag:test
  2271. ### @usage: VALIDATE_DATA_RESTART(ext)
  2272. ###
  2273. ### Change uid for resource validation tests. May be useful when sandbox resource ttl is changed, but test status is cached in CI.
  2274. ### You can change ext to change test's uid. For example VALIDATE_DATA_RESTART(X), where is X is current revision.
  2275. macro VALIDATE_DATA_RESTART(Ext) {
  2276. SET(SBR_UID_EXT $Ext)
  2277. }
  2278. # tag:test
  2279. TEST_FORK_MODE=none
  2280. TEST_PARTITION=SEQUENTIAL
  2281. # tag:test
  2282. ### @usage: FORK_TESTS()
  2283. ###
  2284. ### Splits a test run on chunks by test classes.
  2285. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  2286. ###
  2287. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  2288. ###
  2289. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  2290. macro FORK_TESTS(MODE...) {
  2291. SET(TEST_FORK_MODE tests)
  2292. SET(TEST_PARTITION $MODE)
  2293. }
  2294. # tag:test
  2295. ### @usage: FORK_SUBTESTS()
  2296. ###
  2297. ### Splits the test run in chunks on subtests.
  2298. ### The number of chunks can be overridden using the macro SPLIT_FACTOR.
  2299. ###
  2300. ### Allows to run tests in parallel. Supported in UNITTEST, JTEST/JUNIT5 and PY2TEST/PY3TEST modules.
  2301. ###
  2302. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  2303. macro FORK_SUBTESTS(MODE...) {
  2304. SET(TEST_FORK_MODE subtests)
  2305. SET(TEST_PARTITION $MODE)
  2306. }
  2307. # tag:test
  2308. ### @usage: SPLIT_FACTOR(x)
  2309. ###
  2310. ### Sets the number of chunks for parallel run tests when used in test module with FORK_TESTS() or FORK_SUBTESTS().
  2311. ### If none of those is specified this macro implies FORK_TESTS().
  2312. ###
  2313. ### Supports C++ ut and PyTest.
  2314. ###
  2315. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  2316. macro SPLIT_FACTOR(Factor) {
  2317. SET(TEST_SPLIT_FACTOR $Factor)
  2318. }
  2319. # tag:test
  2320. FORK_TEST_FILES_MODE=
  2321. ### @usage: FORK_TEST_FILES()
  2322. ###
  2323. ### Only for PY2TEST and PY3TEST: splits a file executable with the tests on chunks in the files listed in TEST_SRCS
  2324. ### Compatible with FORK_(SUB)TESTS.
  2325. ###
  2326. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  2327. macro FORK_TEST_FILES() {
  2328. SET(FORK_TEST_FILES_MODE on)
  2329. }
  2330. # tag:test
  2331. TEST_SIZE_NAME=SMALL
  2332. ### @usage: SIZE(SMALL/MEDIUM/LARGE)
  2333. ###
  2334. ### Set the 'size' for the test. Each 'size' has own set of resrtictions, SMALL bein the most restricted and LARGE being the list.
  2335. ### See documentation on test system for more details.
  2336. ###
  2337. ### Documentation about the system test: https://wiki.yandex-team.ru/yatool/test/
  2338. macro SIZE(Type) {
  2339. SET(TEST_SIZE_NAME $Type)
  2340. }
  2341. ### @usage: JOIN_SRCS(Out Src...)
  2342. ###
  2343. ### Join set of sources into single file named Out and send it for further processing.
  2344. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  2345. ### You should specify file name with the extension as Out. Further processing will be done according this extension.
  2346. macro JOIN_SRCS(Out, Src...) {
  2347. .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/gen_join_srcs.py"} ${input;hide:"build/scripts/process_command_files.py"} ${output:Out} --ya-start-command-file ${input;rootrel:Src} --ya-end-command-file ${output_include;from_input;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  2348. .SEM=target_joined_source $Out ${input:Src} ${output;hide;suf=.o:Out} ${input;hide:"build/scripts/gen_join_srcs.py"} ${input;hide:"build/scripts/process_command_files.py"}
  2349. _CONDITIONAL_SRCS($TIDY_VALUE $Src)
  2350. }
  2351. ### @usage: JOIN_SRCS_GLOBAL(Out Src...)
  2352. ###
  2353. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  2354. ### This macro doesn't place all file into Out, it emits #include<Src>... Use the for C++ source files only.
  2355. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  2356. macro JOIN_SRCS_GLOBAL(Out, Src...) {
  2357. .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/gen_join_srcs.py"} ${input;hide:"build/scripts/process_command_files.py"} ${output;noauto:Out} --ya-start-command-file ${input;rootrel:Src} --ya-end-command-file ${output_include;from_input;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  2358. SRCS(GLOBAL $Out)
  2359. }
  2360. ### @usage: FLAT_JOIN_SRCS_GLOBAL(Out Src...)
  2361. ###
  2362. ### Join set of sources into single file named Out and send it for further processing as if it were listed as SRCS(GLOBAL Out).
  2363. ### This macro places all files into single file, so will work with any sources.
  2364. ### You should specify file name with the extension as Out. Further processing will be done according to this extension.
  2365. macro FLAT_JOIN_SRCS_GLOBAL(Out, Src...) {
  2366. .CMD=$FS_TOOLS cat ${output;noauto:Out} --ya-start-command-file ${input:Src} --ya-end-command-file ${output_include;from_input;hide:Src} ${kv;hide:"p JS"} ${kv;hide:"pc magenta"}
  2367. SRCS(GLOBAL $Out)
  2368. }
  2369. # tag:cpu
  2370. PIC_CFLAGS=
  2371. SSE2_CFLAGS=
  2372. SSE3_CFLAGS=
  2373. SSSE3_CFLAGS=
  2374. SSE41_CFLAGS=
  2375. SSE42_CFLAGS=
  2376. POPCNT_CFLAGS=
  2377. PCLMUL_CFLAGS=
  2378. CX16_FLAGS=
  2379. AVX_CFLAGS=
  2380. AVX2_CFLAGS=
  2381. AVX512_CFLAGS=
  2382. AMX_CFLAGS=
  2383. # tag:cpu
  2384. SSE_DEFINES=
  2385. SSE_CFLAGS=
  2386. SSE4_DEFINES=
  2387. SSE4_CFLAGS=
  2388. XOP_CFLAGS=
  2389. NO_LTO_CFLAGS=
  2390. # tag:cpu
  2391. when (($ARCH_X86_64 || $ARCH_I386) && $DISABLE_INSTRUCTION_SETS != "yes") {
  2392. when ($CLANG || $CLANG_CL || $GCC) {
  2393. PIC_CFLAGS=-fPIC
  2394. SSE2_CFLAGS=-msse2
  2395. SSE3_CFLAGS=-msse3
  2396. SSSE3_CFLAGS=-mssse3
  2397. SSE41_CFLAGS=-msse4.1
  2398. SSE42_CFLAGS=-msse4.2
  2399. XOP_CFLAGS=-mxop
  2400. POPCNT_CFLAGS=-mpopcnt
  2401. PCLMUL_CFLAGS=-mpclmul
  2402. AVX_CFLAGS=-mavx
  2403. # On Intel BMI1, BMI2 and FMA3 instruction sets come together with AVX-2 extension starting with Broadwell / Haswell.
  2404. # See:
  2405. # https://en.wikipedia.org/wiki/FMA_instruction_set
  2406. # https://en.wikipedia.org/wiki/X86_Bit_manipulation_instruction_set
  2407. #
  2408. # AMD implemented FMA3 in Piledriver architecture over AVX (that is, prior to AVX-2 which was introduced in Zen).
  2409. # BMI2 implementation was released by AMD along with AVX-2 support.
  2410. # See:
  2411. # https://en.wikipedia.org/wiki/Template:AMD_x86_CPU_features
  2412. #
  2413. # Due to the above, it looks safe to enable all three extensions whenever AVX-2 is enabled.
  2414. AVX2_CFLAGS=-mavx2 -mfma -mbmi -mbmi2
  2415. # All Intel CPUS with AVX-512 have these instructions except for the Knights Landing / Knights Mill
  2416. # (these are Xeon Phi)
  2417. # See:
  2418. # https://en.wikichip.org/wiki/x86/avx-512
  2419. AVX512_CFLAGS=-mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl
  2420. # AMX stands Advanced Matrix Extension supported by modern Intel architectures
  2421. # See:
  2422. # https://en.wikipedia.org/wiki/Advanced_Matrix_Extensions
  2423. # https://en.wikichip.org/wiki/x86/amx
  2424. AMX_CFLAGS=-mamx-tile -mamx-int8 ${AVX512_CFLAGS}
  2425. when ($ARCH_X86_64 && $OS_ANDROID != "yes") {
  2426. CX16_FLAGS=-mcx16
  2427. }
  2428. SSE_DEFINES=-DSSE_ENABLED=1 -DSSE3_ENABLED=1 -DSSSE3_ENABLED=1
  2429. SSE4_DEFINES=-DSSE41_ENABLED=1 -DSSE42_ENABLED=1 -DPOPCNT_ENABLED=1 -DCX16_ENABLED=1
  2430. }
  2431. elsewhen ($MSVC) {
  2432. SSE2_CFLAGS=/D__SSE2__=1
  2433. SSE3_CFLAGS=/D__SSE3__=1
  2434. SSSE3_CFLAGS=/D__SSSE3__=1
  2435. SSE41_CFLAGS=/D__SSE4_1__=1
  2436. SSE42_CFLAGS=/D__SSE4_2__=1
  2437. POPCNT_CFLAGS=/D__POPCNT__=1
  2438. PCLMUL_CFLAGS=/D__PCLMUL__=1
  2439. AVX_CFLAGS=/arch:AVX /DAVX_ENABLED=1
  2440. AVX2_CFLAGS=/arch:AVX2 /DAVX2_ENABLED=1
  2441. AVX512_CFLAGS=/arch:AVX512 /DAVX512_ENABLED=1
  2442. SSE_DEFINES=/DSSE_ENABLED=1 /DSSE3_ENABLED=1 /DSSSE3_ENABLED=1
  2443. SSE4_DEFINES=/DSSE41_ENABLED=1 /DSSE42_ENABLED=1 /DPOPCNT_ENABLED=1 /DCX16_ENABLED=1
  2444. }
  2445. SSE_CFLAGS=$SSE2_CFLAGS $SSE3_CFLAGS $SSSE3_CFLAGS
  2446. SSE4_CFLAGS=$SSE41_CFLAGS $SSE42_CFLAGS $POPCNT_CFLAGS $CX16_FLAGS
  2447. when ($ARCH_I386 && $OS_ANDROID == "yes") {
  2448. USE_SSE4=no
  2449. }
  2450. }
  2451. otherwise {
  2452. USE_SSE4=no
  2453. CPU_CHECK=no
  2454. }
  2455. # tag:cpu
  2456. when ($NOSSE == "yes") {
  2457. USE_SSE4=no
  2458. }
  2459. # tag:cpu
  2460. ### @usage: NO_SSE4()
  2461. ###
  2462. ### Compile module without SSE4
  2463. macro NO_SSE4() {
  2464. SET(USE_SSE4 no)
  2465. }
  2466. # tag:cpu
  2467. ### @usage: NO_CPU_CHECK()
  2468. ###
  2469. ### Compile module without startup CPU features check
  2470. macro NO_CPU_CHECK() {
  2471. SET(CPU_CHECK no)
  2472. }
  2473. ### @usage: ADDINCLSELF()
  2474. ###
  2475. ### The macro adds the -I<project source path> flag to the source compilation flags of the current project.
  2476. macro ADDINCLSELF(FOR="") {
  2477. when($FOR) {
  2478. ADDINCL+=FOR $FOR ${MODDIR}
  2479. }
  2480. otherwise {
  2481. ADDINCL+=${MODDIR}
  2482. }
  2483. }
  2484. COMPILE_OUT_SUFFIX=
  2485. _COMPILE_OUTPUTS=${output;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}:SRC}
  2486. _COMPILE_TIME_TRACE_OUTPUTS=${output;noauto;suf=${COMPILE_OUT_SUFFIX}${OBJECT_SUF}.time_trace.json:SRC}
  2487. macro SET_COMPILE_OUTPUTS_MODIFIERS(NOREL?";norel":"") {
  2488. SET(_COMPILE_OUTPUTS \${output;suf=\${OBJECT_SUF}$NOREL:SRC})
  2489. SET(_COMPILE_TIME_TRACE_OUTPUTS \${output;noauto;suf=\${OBJECT_SUF}.time_trace.json$NOREL:SRC})
  2490. }
  2491. # tag:internal
  2492. ### @usage: _ADD_EXTRA_FLAGS_IMPL([GENERATE] Args...) # internal
  2493. ### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " before $Args when GENERATE
  2494. ### is specified in the list of actual arguments
  2495. macro _ADD_EXTRA_FLAGS_IMPL(GENERATE?" && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS ":"", Args...) {
  2496. .SEM=$GENERATE $Args
  2497. }
  2498. # tag:internal
  2499. ### @usage: _ADD_EXTRA_FLAGS([GENERATE] Args...) # internal
  2500. ### Generate prefix = " && set_property SOURCE ${input:SRC} APPEND PROPERTY COMPILE_OPTIONS " if Args is not empty
  2501. macro _ADD_EXTRA_FLAGS(COMPILE_OUT_SUFFIX="", Args...) {
  2502. .SEM=$_ADD_EXTRA_FLAGS_IMPL(${pre=GENERATE :Args})
  2503. }
  2504. _EMPTY_CMD=
  2505. # tag:src-processing tag:internal
  2506. ### @usage: _SRC(Ext Src Flags) # internal
  2507. ###
  2508. ### Basic building block of extension-based command dispatching
  2509. ### To enable specific extension processing define _SRC() macro with fixed first argument (Ext).
  2510. ### Internal logic will apply this macro to all files with this Ext listed in SRC/SRCS macros or outputs
  2511. ### of other commands (except ones marked as noauto)
  2512. macro _SRC(EXT, SRC, SRCFLAGS...) {
  2513. # Generic macro definition for _SRC (just a placeholder, it does nothing)
  2514. }
  2515. # tag:src-processing
  2516. macro _SRC("swg", SRC, SRCFLAGS...) {
  2517. .CMD=${_SWIG_CMD}
  2518. .PEERDIR=${_SWIG_PEERDIR}
  2519. .SEM=conan_require_tool swig/4.0.2 && conan_import '"bin, *swig* -> ./bin"' ${input;hide:SRC} ${_SWIG_SEM_TO_MODULE_LINK}
  2520. }
  2521. RODATA_SYMBOL_PREFIX=
  2522. when ($DARWIN == "yes" || $IOS == "yes" || ($WINDOWS == "yes" && $ARCH_TYPE_32 == "yes")) {
  2523. RODATA_SYMBOL_PREFIX=_
  2524. }
  2525. RODATA_ELF_FLAGS=
  2526. when($LINUX == "yes" || $ANDROID == "yes") {
  2527. RODATA_ELF_FLAGS=--elf
  2528. }
  2529. RODATA_COMPILE=$YMAKE_PYTHON3 ${input:"build/scripts/rodata2asm.py"} $RODATA_ELF_FLAGS ${RODATA_SYMBOL_PREFIX}${noext;nopath:SRC} ${input:SRC} ${tmp;suf=.asm:SRC} ${hide:OBJECT_SUF} && $_SRC_yasm_helper(${tmp;suf=.asm:SRC})
  2530. when (($ARCH_AARCH64 || $ARCH_ARM || $ARCH_PPC64LE || $ARCH_RISCV32) == "yes") {
  2531. RODATA_COMPILE=$YMAKE_PYTHON3 ${input:"build/scripts/rodata2cpp.py"} ${noext;nopath:SRC} ${input:SRC} ${output;suf=.cpp:SRC}
  2532. }
  2533. # tag:src-processing
  2534. macro _SRC("rodata", SRC, SRCFLAGS...) {
  2535. .CMD=$RODATA_COMPILE ${hide;kv:"p RD"} ${hide;kv:"pc light-green"}
  2536. .SEM=target_rodata_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} ${input;hide:"build/scripts/rodata2cpp.py"}
  2537. }
  2538. macro _SRS_S_ASM(SRC, SRCFLAGS...) {
  2539. .CMD=$C_COMPILER $C_FLAGS_PLATFORM $CFLAGS $SFLAGS $SRCFLAGS -c -o ${output:SRC.o} ${input:SRC} $TOOLCHAIN_ENV ${pre=-I:_C__INCLUDE}
  2540. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS) && add_language ASM
  2541. }
  2542. # tag:src-processing
  2543. macro _SRC("S", SRC, SRCFLAGS...) {
  2544. .CMD=$_SRS_S_ASM($SRC, $SRCFLAGS)
  2545. .SEM=$_SRS_S_ASM($SRC, $SRCFLAGS)
  2546. }
  2547. # tag:src-processing
  2548. macro _SRC("s", SRC, SRCFLAGS...) {
  2549. .CMD=$_SRS_S_ASM($SRC, $SRCFLAGS)
  2550. .SEM=$_SRS_S_ASM($SRC, $SRCFLAGS)
  2551. }
  2552. # tag:src-processing
  2553. macro _SRC("s79", SRC, SRCFLAGS...) {
  2554. .CMD=$_SRC(S, $SRC $SRCFLAGS -x assembler-with-cpp)
  2555. }
  2556. # tag:src-processing
  2557. macro _SRC("mm", SRC, SRCFLAGS...) {
  2558. .CMD=$C_COMPILER $C_FLAGS_PLATFORM -x objective-c++ -fobjc-arc -fobjc-abi-version=2 -c -o ${output:SRC.o} ${input:SRC} $CXXFLAGS ${pre=-I:_C__INCLUDE} ${SRCFLAGS} ${kv;hide:"p CC"} ${kv;hide:"pc light-green"} $TOOLCHAIN_ENV
  2559. }
  2560. # tag:src-processing
  2561. macro _SRC("fml", SRC, SRCFLAGS...) {
  2562. .CMD=$FML_TOOL $CHECKFLAG -b -o ${output:SRC.inc} -T ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  2563. }
  2564. # tag:src-processing
  2565. macro _SRC("fml2", SRC, SRCFLAGS...) {
  2566. .CMD=$FML_TOOL $CHECKFLAG -b -o ${output;nopath;noext:SRC.fml.inc} -2 -O ${output;nopath;noext:SRC.fml.cpp} -T ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  2567. }
  2568. # tag:src-processing
  2569. macro _SRC("fml3", SRC, SRCFLAGS...) {
  2570. .CMD=$FML_TOOL $CHECKFLAG -b -o ${output;nopath;noext:SRC.fml.inc} -3 -O ${output;nopath;noext:SRC.fml.cpp} -L ${input;nopath;noext:SRC.list} -P ${nopath;noext:SRC} -T ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  2571. }
  2572. # tag:src-processing
  2573. macro _SRC("sfdl", SRC, SRCFLAGS...) {
  2574. .CMD=$CXX_COMPILER $C_FLAGS_PLATFORM $CXXFLAGS $SFDL_FLAG ${SRCFLAGS} ${input:SRC} && ${tool:"tools/calcstaticopt"} -i ${tmp:SRC.tmp} -a $ARCADIA_ROOT ${output;stdout;nopath;noext;defext=.inc:SRC} ${kv;hide:"p SF"} ${kv;hide:"pc yellow"} $TOOLCHAIN_ENV
  2575. }
  2576. macro _XS_SRCS(SRC, TYPEMAPS[], SRCFLAGS...) {
  2577. .CMD=$PERL_LD_LIBRARY_PATH $PERL $PERL_INCLUDE ${suf=/ExtUtils/xsubpp:PERL_PRIVLIB} -typemap ${suf=/ExtUtils/typemap:PERL_PRIVLIB} $PERLSUFFIX $XSUBPPFLAGS ${pre=-typemap :TYPEMAPS} ${input;hide:TYPEMAPS} ${SRCFLAGS} ${input:SRC} ${PERLOUTPUT} ${kv;hide:"p XS"} ${kv;hide:"pc yellow"}
  2578. }
  2579. # tag:src-processing
  2580. macro _SRC("xs", SRC, SRCFLAGS...) {
  2581. .CMD=$_XS_SRCS($SRC TYPEMAPS $_XSTYPEMAPS $SRCFLAGS)
  2582. }
  2583. # tag:src-processing
  2584. macro _SRC("gperf", SRC, SRCFLAGS...) {
  2585. .CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/gperf"} $GP_FLAGS ${SRCFLAGS} ${pre=-Nin_;suf=_set;nopath;noallext:SRC} ${input:SRC} ${output;stdout;nopath;noext;defext=.gperf.cpp:SRC} ${kv;hide:"p GP"} ${kv;hide:"pc yellow"}
  2586. }
  2587. # tag:src-processing
  2588. macro _SRC("rl", SRC, SRCFLAGS...) {
  2589. .CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/ragel5/ragel"} $RAGEL_FLAGS ${SRCFLAGS} -o ${tmp:SRC.tmp} ${input:SRC} && $RUN_NO_SANITIZE ${tool:"contrib/tools/ragel5/rlgen-cd"} $RLGEN_FLAGS -o ${output;nopath;noext;defext=.rl5.cpp:SRC} ${tmp:SRC.tmp} ${kv;hide:"p R5"} ${kv;hide:"pc yellow"}
  2590. }
  2591. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  2592. .CMD=$YMAKE_PYTHON ${input:"library/cpp/xml/parslib/xsyn2ragel.py"} ${input:SRC} ${input:"library/cpp/xml/parslib/xmlpars.xh"} dontuse ${output;stdout;suf=.h.rl5:SRC} ${kv;hide:"p XN"} ${kv;hide:"pc yellow"}
  2593. }
  2594. # tag:src-processing
  2595. macro _SRC("rl5", SRC, SRCFLAGS...) {
  2596. .CMD=$_SRC(rl $SRC $SRCFLAGS)
  2597. }
  2598. # tag:src-processing
  2599. macro _SRC("asp", SRC, SRCFLAGS...) {
  2600. .CMD=$RUN_NO_SANITIZE ${tool:"tools/html2cpp"} ${input:SRC} ${output:SRC.cpp} ${kv;hide:"p HT"} ${kv;hide:"pc yellow"}
  2601. }
  2602. # tag:src-processing
  2603. macro _SRC("rl6", SRC, SRCFLAGS...) {
  2604. .CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/ragel6"} $RAGEL6_FLAGS ${SRCFLAGS} -L -I${ARCADIA_ROOT} -o ${output;nopath;noext;defext=.rl6.cpp:SRC} ${input:SRC} ${kv;hide:"p R6"} ${kv;hide:"pc yellow"}
  2605. .SEM=target_ragel_lexers PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $RAGEL6_FLAGS ${SRCFLAGS} && set_global_flags RAGEL_FLAGS -L -I $S/ && conan_require_tool ragel/6.10 && conan_import '"bin, ragel* -> ./bin"' ${input;hide:"build/scripts/run_tool.py"}
  2606. }
  2607. # tag:src-processing
  2608. macro _SRC("pln", SRC, SRCFLAGS...) {
  2609. .CMD=$FML_TOOL -b -o ${output;pre=pln.;nopath;noext:SRC.cpp} -f ${input:SRC} ${SRCFLAGS} ${kv;hide:"p FM"} ${kv;hide:"pc yellow"}
  2610. }
  2611. # tag:src-processing
  2612. macro _SRC("xsyn", SRC, SRCFLAGS...) {
  2613. .CMD=$YMAKE_PYTHON ${input:"library/cpp/xml/parslib/xsyn2ragel.py"} ${input:SRC} ${input:"library/cpp/xml/parslib/xmlpars.xh"} dontuse ${output;stdout:SRC.h.rl5} ${kv;hide:"p XN"} ${kv;hide:"pc yellow"}
  2614. }
  2615. # tag:src-processing
  2616. macro _SRC("ev", SRC, SRCFLAGS...) {
  2617. .CMD=$EVLOG_CMD($SRC)
  2618. .SEM=$EVLOG_CMD($SRC)
  2619. }
  2620. # tag:src-processing
  2621. macro _SRC("proto", SRC, SRCFLAGS...) {
  2622. .CMD=$PROTO_CMD($SRC)
  2623. .SEM=$PROTO_CMD($SRC)
  2624. }
  2625. # tag:src-processing
  2626. macro _SRC("gztproto", SRC, SRCFLAGS...) {
  2627. # _PROTO__INCLUDE is before ARCADIA_ROOT in includes because in gazetteer we don't use builtins now and paths' canonization (resolving) depends on order of roots.
  2628. # descriptor.proto must be resolved as google/protobuf/descriptor.proto
  2629. .CMD=${tool:"dict/gazetteer/converter"} -I$PROTOBUF_PATH ${pre="-I":_PROTO__INCLUDE} -I$ARCADIA_ROOT ${SRCFLAGS} ${input:SRC} ${output;nopath;noext;norel:SRC.proto} ${kv;hide:"p GZ"} ${kv;hide:"pc yellow"}
  2630. .PEERDIR=kernel/gazetteer/proto
  2631. }
  2632. # tag:src-processing
  2633. macro _SRC("cfgproto", SRC, SRCFLAGS...) {
  2634. .CMD=$_CPP_CFGPROTO_CMD($SRC)
  2635. }
  2636. # tag:src-processing
  2637. macro _SRC("pyx", SRC, SRCFLAGS...) {
  2638. # Copy-paste from BUILDWITH_CYTHON
  2639. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:SRC} -o ${output;tobindir;suf=${OBJ_SUF}.cpp:SRC} $CYTHON_OUTPUT_INCLUDES ${SRCFLAGS} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  2640. .SEM=target_cython_sources PRIVATE ${input:Src} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS --cplus ${SRCFLAGS} ${CYTHON_CPP_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  2641. .ADDINCL=FOR cython contrib/tools/cython/Cython/Includes
  2642. }
  2643. # tag:src-processing
  2644. macro _SRC("in", SRC, SRCFLAGS...) {
  2645. .CMD=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  2646. .SEM=$CONFIGURE_FILE(${SRC} ${nopath;noext:SRC})
  2647. }
  2648. macro MANUAL_GENERATION(Outs...) {
  2649. .SEM=IGNORED ${output;hide;noauto:Outs}
  2650. }
  2651. # tag:src-processing
  2652. macro _SRC("sc", SRC, SRCFLAGS...) {
  2653. .CMD=${tool:"tools/domschemec"} --in ${input:SRC} --out ${output;norel:SRC.h} ${output_include;hide:"util/generic/strbuf.h"} ${output_include;hide:"array"} ${output_include;hide:"util/generic/string.h"} ${output_include;hide:"util/generic/vector.h"} ${output_include;hide:"util/string/cast.h"} ${SRCFLAGS} ${kv;hide:"p SC"} ${kv;hide:"pc yellow"}
  2654. }
  2655. # tag:src-processing
  2656. macro _SRC("ssqls", SRC, SRCFLAGS...) {
  2657. .CMD=${tool:"metrika/core/tools/ssqls"} ${input;notransformbuilddir:SRC} -S $ARCADIA_ROOT -B $ARCADIA_BUILD_ROOT $SRCFLAGS ${output;noext;hide:SRC.cpp} ${output;noext;hide:SRC.h} ${kv;hide:"p SS"} ${kv;hide:"pc yellow"}
  2658. }
  2659. # tag:src-processing
  2660. macro _SRC("f", SRC, SRCFLAGS...) {
  2661. .CMD=$YMAKE_PYTHON ${input:"build/scripts/f2c.py"} -t ${tool:"contrib/tools/f2c"} -c ${input:SRC} -o ${output:SRC.c} ${output_include;hide:"f2c.h"} ${kv;hide:"p FT"} ${kv;hide:"pc light-green"}
  2662. .PEERDIR=contrib/libs/libf2c
  2663. .ADDINCL=contrib/libs/libf2c
  2664. }
  2665. # tag:src-processing
  2666. macro _SRC("cpp", SRC, SRCFLAGS...) {
  2667. .CMD=$_SRC_cpp($SRC $SRCFLAGS)
  2668. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  2669. }
  2670. # tag:src-processing
  2671. macro _SRC("cxx", SRC, SRCFLAGS...) {
  2672. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  2673. }
  2674. # tag:src-processing
  2675. macro _SRC("cc", SRC, SRCFLAGS...) {
  2676. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  2677. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS)
  2678. }
  2679. # tag:src-processing
  2680. macro _SRC("auxcpp", SRC, SRCFLAGS...) {
  2681. .CMD=$_SRC_cpp($SRC $_FORCE_CPP_FLAGS $SRCFLAGS)
  2682. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($_FORCE_CPP_FLAGS $SRCFLAGS)
  2683. }
  2684. # tag:src-processing
  2685. macro _SRC("C", SRC, SRCFLAGS...) {
  2686. .CMD=$_SRC(cpp $SRC $SRCFLAGS)
  2687. }
  2688. # tag:src-processing
  2689. macro _SRC("c", SRC, SRCFLAGS...) {
  2690. .CMD=$_SRC_c($SRC $SRCFLAGS)
  2691. .SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $_ADD_EXTRA_FLAGS($SRCFLAGS $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL)
  2692. }
  2693. # tag:src-processing
  2694. macro _SRC("m", SRC, SRCFLAGS...) {
  2695. .CMD=$_SRC(c $SRC $SRCFLAGS)
  2696. }
  2697. MASM_SEM=target_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} \
  2698. && curdir_masm_flags ${MASMFLAGS}
  2699. YASM_SEM=target_yasm_source PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS ${pre=-P :PREINCLUDES} ${input;hide:"build/scripts/run_tool.py"} \
  2700. && set_global_flags YASM_FLAGS -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} $_YASM_PLATFORM_FLAGS_VALUE -D ${pre=_;suf=_:HARDWARE_TYPE} -D_YASM_ $ASM_PREFIX_VALUE $_YASM_PREDEFINED_FLAGS_VALUE \
  2701. && add_language ASM \
  2702. && conan_require_tool yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
  2703. ASM_SEM=target_yasm_source PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS ${input;hide:"build/scripts/run_tool.py"} \
  2704. && set_global_flags YASM_FLAGS -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} $_YASM_PLATFORM_FLAGS_VALUE -D ${pre=_;suf=_:HARDWARE_TYPE} -D_YASM_ $ASM_PREFIX_VALUE $_YASM_PREDEFINED_FLAGS_VALUE \
  2705. && add_language ASM \
  2706. && conan_require_tool yasm/1.3.0 && conan_import '"bin, *yasm* -> ./bin"' && conan_import '"bin, ytasm* -> ./bin"'
  2707. # tag:src-processing
  2708. macro _SRC("masm", SRC, SRCFLAGS...) {
  2709. .CMD=$_SRC_masm($SRC $SRCFLAGS)
  2710. .SEM=$MASM_SEM
  2711. }
  2712. # tag:src-processing
  2713. macro _SRC("yasm", SRC, SRCFLAGS...) {
  2714. .CMD=$_SRC_yasm($SRC $SRCFLAGS PREINCLUDES $YASM_PREINCLUDES_VALUE)
  2715. .SEM=$YASM_SEM
  2716. }
  2717. # tag:src-processing
  2718. macro _SRC("asm", SRC, SRCFLAGS...) {
  2719. .CMD=$_SRC_ASM($SRC $SRCFLAGS PREINCLUDES $YASM_PREINCLUDES_VALUE)
  2720. .SEM=$ASM_SEM
  2721. }
  2722. # tag:src-processing
  2723. macro _SRC("lua", SRC, SRCFLAGS...) {
  2724. .CMD=${cwd:LUAJIT_PATH} ${tool:"contrib/libs/luajit/compiler"} -b -g ${input:SRC} ${SRCFLAGS} ${global;output;suf=.o:SRC} ${kv;hide:"p LJ"} ${kv;hide:"pc light-cyan"}
  2725. .PEERDIR=$LUAJIT_PATH
  2726. }
  2727. NVCC_CFLAGS=
  2728. when ($IDE_MSVS_CALL == "yes") {
  2729. # This is to avoid issues with .pdb from MSVC calling nvcc calling cl
  2730. NVCC_CFLAGS+=/Fd$(TEMP)
  2731. }
  2732. NVCC_STD_VER=14
  2733. when ($MSVC == "yes") {
  2734. NVCC_STD=/std:c++${NVCC_STD_VER}
  2735. }
  2736. otherwise {
  2737. NVCC_STD=-std=c++${NVCC_STD_VER}
  2738. }
  2739. # tag:src-processing
  2740. macro _SRC("cu", SRC, SRCFLAGS...) {
  2741. .CMD=$_SRC_CU_CMD
  2742. .SEM=target_cuda_sources PRIVATE ${input:SRC} ${output;hide;suf=${OBJ_SUF}.o:SRC} && set_global_flags CMAKE_CUDA_STANDARD ${NVCC_STD_VER} && target_cuda_flags $CUDA_NVCC_FLAGS && target_cuda_cflags $USER_CXXFLAGS $SRCFLAGS $_SEM_EXTRA_CXX_FLAGS
  2743. .PEERDIR=$_SRC_CU_PEERDIR
  2744. }
  2745. # tag:src-processing
  2746. macro _SRC("fbs", SRC, SRCFLAGS...) {
  2747. .CMD=$FBS_CMD($SRC, $SRCFLAGS)
  2748. .SEM=$FBS_CMD($SRC, $SRCFLAGS)
  2749. }
  2750. # tag:src-processing
  2751. macro _SRC("fbs64", SRC, SRCFLAGS...) {
  2752. .CMD=$_CPP_FLATC64_CMD($SRC, $SRCFLAGS)
  2753. }
  2754. # tag:src-processing
  2755. macro _SRC("pysrc", SRC, SRCFLAGS...) {
  2756. .CMD=$_SRC_PYSRC($SRC, $SRCFLAGS)
  2757. }
  2758. # tag:src-processing
  2759. # This triggers configure error in attempt to add `ya.make` to SRCS macro or apply automatic processing by extension from codegen
  2760. macro _SRC("make", SRC, SRCFLAGS...) {
  2761. .CMD=
  2762. }
  2763. @import "${CONF_ROOT}/conf/bison_lex.conf"
  2764. # tag:src-processing
  2765. macro _SRC_py2src(SRC, SRCFLAGS...) {
  2766. .CMD=${cwd:BINDIR} $YMAKE_PYTHON3 ${input:"build/scripts/compile_pysrc.py"} --input ${input:SRC} --output ${output;noext;suf=.py2_raw.cpp:SRC} --rescompiler ${tool:"tools/rescompiler"} py2 --python $(PYTHON)/python --py_compile ${input:"build/scripts/py_compile.py"} ${kv;hide:"p P2"} ${kv;hide:"pc light-green"}
  2767. }
  2768. # tag:src-processing
  2769. macro _SRC_py3src(SRC, SRCFLAGS...) {
  2770. .CMD=${cwd:BINDIR} $YMAKE_PYTHON3 ${input:"build/scripts/compile_pysrc.py"} --input ${input:SRC} --output ${output;noext;suf=.py3_raw.cpp:SRC} --rescompiler ${tool:"tools/rescompiler"} py3 --pycc ${tool:"tools/py3cc"} ${kv;hide:"p P3"} ${kv;hide:"pc light-green"}
  2771. }
  2772. # tag:src-processing python-specific
  2773. when ($PYTHON3 == "yes") {
  2774. _SRC_PYSRC_CMDLINE=$_SRC_py3src($SRC $SRCFLAGS)
  2775. }
  2776. otherwise {
  2777. _SRC_PYSRC_CMDLINE=$_SRC_py2src($SRC $SRCFLAGS)
  2778. }
  2779. # tag:src-processing tag:python-specific
  2780. macro _SRC_PYSRC(SRC, SRCFLAGS...) {
  2781. .CMD=$_SRC_PYSRC_CMDLINE
  2782. }
  2783. # tag:src-processing
  2784. macro _SRC_c_nodeps(SRC, OUTFILE, INC...) {
  2785. .CMD=$_SRC_C_NODEPS_CMD
  2786. }
  2787. # Custom flags for generated cpp-files. To support another generator:
  2788. # - insert additional file extension before .cpp into generated cpp-file name
  2789. # - update _LANG_CFLAGS_FILTER variable. Don't forget to add ' SKIP ' after flag list
  2790. #
  2791. # ragel5 and ragel6 generated terrible code which makes use of goto's in switch statements.
  2792. # This triggers -Werror-implicit-fallthrough due to `unannotated fall-through between switch labels`.
  2793. #
  2794. # cython generated code also fails to pass this diagnostics due to `fallthrough annotation in unreachable code`.
  2795. # We use cython==0.29.26 at the time. This issue might be fixed in further versions.
  2796. #
  2797. # flags -fno-profile-instr-generate -fno-coverage-mapping needed to always disable coverage for .pyx, .rl5, .rl6
  2798. # generated sources
  2799. ## tag:src-processing
  2800. when ($CLANG == "yes") {
  2801. _LANG_CFLAGS_FILTER=\
  2802. ${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.rl5:SRC} \
  2803. ${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.rl6:SRC} \
  2804. ${pre=-Wno-implicit-fallthrough -fno-profile-instr-generate -fno-coverage-mapping SKIP ;ext=.pyx:SRC}
  2805. }
  2806. otherwise {
  2807. _LANG_CFLAGS_FILTER=\
  2808. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl5:SRC} \
  2809. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.rl6:SRC} \
  2810. ${pre=-Wno-implicit-fallthrough SKIP ;ext=.pyx:SRC}
  2811. }
  2812. # tag:src-processing
  2813. # Magic macro for removing file name from result (file name is passed as unused SKIP parameter)
  2814. macro _FILTER_EXTS(SKIP="", FLAGS...) {
  2815. .CMD=$FLAGS
  2816. }
  2817. # tag:src-processing
  2818. macro _LANG_CFLAGS(SRC) {
  2819. .CMD=$_FILTER_EXTS($_LANG_CFLAGS_FILTER)
  2820. }
  2821. # tag:src-processing
  2822. # ymake bug workaround: variables followed a macros call in .CMD are not substituted and are placed in result as is
  2823. # Pack macro call into a variable and use it in _SRC_CPP_CMD instead of macro call
  2824. _LANG_CFLAGS_VALUE=
  2825. when ($CLANG == "yes" || $CLANG_CL == "yes" || $GCC == "yes") {
  2826. _LANG_CFLAGS_VALUE=$_LANG_CFLAGS(${noext:SRC})
  2827. }
  2828. # Allows to add single compilation unit name to the node's 'kv' section.
  2829. # This is used by the coverage machinery to instrument only the necessary sources
  2830. # when --coverage-prefix-filter <rootrelpath> is specified. For more info see DEVTOOLSSUPPORT-16891
  2831. SCU_NAME_KV=
  2832. when ($CLANG_COVERAGE && $CLANG_COVERAGE != "no" && $USE_SCU_VALUE == "yes") {
  2833. SCU_NAME_KV=${hide;kv:"scu_name $KV_VAL"}
  2834. }
  2835. macro _ADD_SCU_NAME(KV_VAL) {
  2836. .CMD=$SCU_NAME_KV
  2837. }
  2838. # tag:src-processing
  2839. macro _SRC_cpp(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  2840. .CMD=$_SRC_CPP_CMD $_ADD_SCU_NAME(${input:SRC})
  2841. }
  2842. # tag:src-processing
  2843. macro _SRC_c(SRC, COMPILE_OUT_SUFFIX="", SRCFLAGS...) {
  2844. .CMD=$_SRC_C_CMD $_ADD_SCU_NAME(${input:SRC})
  2845. }
  2846. # tag:src-processing
  2847. macro _SRC_m(SRC, SRCFLAGS...) {
  2848. .CMD=$_SRC_M_CMD
  2849. }
  2850. # tag:src-processing
  2851. macro _SRC_masm(SRC, SRCFLAGS...) {
  2852. .CMD=$_SRC_MASM_CMD
  2853. }
  2854. # tag:lua-specific
  2855. ### @usage: COMPILE_LUA(Src, [NAME <import_name>])
  2856. ###
  2857. ### Compile LUA source file to object code using LUA 2.0
  2858. ### Optionally override import name which is by default reflects Src name
  2859. macro COMPILE_LUA(Src, NAME="") {
  2860. .CMD=$_SRC(lua, $Src, ${pre=-n :NAME})
  2861. }
  2862. # tag:lua-specific
  2863. ### @usage: _SRC_lua_21(SRC [SRCFLAGS...]) # internal
  2864. ###
  2865. ### Compile LUA source file to object code using LUA 2.1
  2866. macro _SRC_lua_21(SRC, SRCFLAGS...) {
  2867. .CMD=${cwd:LUAJIT_21_PATH} ${tool:"contrib/libs/luajit_21/compiler"} -b -g ${input:SRC} ${SRCFLAGS} ${global;output;suf=.o:SRC} ${kv;hide:"p LJ"} ${kv;hide:"pc light-cyan"}
  2868. .PEERDIR=$LUAJIT_21_PATH
  2869. }
  2870. # tag:lua-specific
  2871. ### @usage: COMPILE_LUA_21(Src, [NAME <import_name>])
  2872. ###
  2873. ### Compile LUA source file to object code using LUA 2.1
  2874. ### Optionally override import name which is by default reflects Src name
  2875. macro COMPILE_LUA_21(Src, NAME="") {
  2876. .CMD=$_SRC_lua_21($Src, ${pre=-n :NAME})
  2877. }
  2878. # tag:lua-specific
  2879. ### @usage: _SRC_lua_openresty(SRC [SRCFLAGS...]) # internal
  2880. ###
  2881. ### Compile LUA source file to object code using OpenResty LUA 2.1
  2882. macro _SRC_lua_openresty(SRC, SRCFLAGS...) {
  2883. .CMD=${cwd:LUAJIT_OPENRESTY_PATH} ${tool:"contrib/libs/luajit_openresty/compiler"} -b -g ${input:SRC} ${SRCFLAGS} ${global;output;suf=.o:SRC} ${kv;hide:"p LJ"} ${kv;hide:"pc light-cyan"}
  2884. .PEERDIR=$LUAJIT_OPENRESTY_PATH
  2885. }
  2886. # tag:lua-specific
  2887. ### @usage: COMPILE_LUA_OPENRESTY(Src, [NAME <import_name>])
  2888. ###
  2889. ### Compile LUA source file to object code using OpenResty LUA 2.1
  2890. ### Optionally override import name which is by default reflects Src name
  2891. macro COMPILE_LUA_OPENRESTY(Src, NAME="") {
  2892. .CMD=$_SRC_lua_openresty($Src, ${pre=-n :NAME})
  2893. }
  2894. GETTEXT_KEEP_PATH=no
  2895. _MO_OUTPUT=
  2896. when ($GETTEXT_KEEP_PATH == "yes") {
  2897. _MO_OUTPUT=${output;noauto;norel;noext:SRC.mo}
  2898. }
  2899. otherwise {
  2900. _MO_OUTPUT=${output;noauto;nopath;noext;tobindir:SRC.mo}
  2901. }
  2902. # tag:src-processing
  2903. macro _SRC("po", SRC, SRCFLAGS...) {
  2904. .CMD=$YMAKE_PYTHON ${input:"contrib/tools/python/src/Tools/i18n/msgfmt.py"} -o $_MO_OUTPUT ${input:SRC}
  2905. }
  2906. # tag:ydl-specific
  2907. YDL_FLAGS= --force-color -I ${ARCADIA_ROOT}
  2908. YDL_DESC_FLAGS=
  2909. # tag:src-processing tag:ydl-specific
  2910. macro _SRC("ydl", SRC, SRCFLAGS...) {
  2911. .CMD=${tool:"statbox/ydl/compiler/tooling/ydl/bin"} c $YDL_FLAGS --cpp-output-header ${output;suf=.h:SRC} --cpp-output-source ${output;suf=.cpp:SRC} ${input:SRC} ${output_include;hide:"statbox/ydl/runtime/cpp/gen_support/standard_includes.h"} ${kv;hide:"p YDL"} ${kv;hide:"pc yellow"}
  2912. .PEERDIR+=statbox/ydl/runtime/cpp
  2913. }
  2914. # tag:ydl-specific
  2915. ### @usage BUILD_YDL_DESC(Input Symbol Output)
  2916. ###
  2917. ### Generate a descriptor for a Symbol located in a ydl module Input, and put it to the file Output.
  2918. ###
  2919. ### @example:
  2920. ###
  2921. ### PACKAGE()
  2922. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  2923. ### END()
  2924. ###
  2925. ### This will parse file ../types.ydl, generate a descriptor for a symbol Event defined in the said file, and put the descriptor to the Event.ydld.
  2926. macro BUILD_YDL_DESC(Input, Symbol, Output) {
  2927. .CMD=${tool:"statbox/ydl/compiler/tooling/ydl/bin"} ti $YDL_FLAGS $YDL_DESC_FLAGS -o ${output;noauto:Output} ${input:Input} ${Symbol} ${kv;hide:"p YDL"} ${kv;hide:"pc yellow"}
  2928. }
  2929. # tag:ydl-specific
  2930. ### @usage: YDL_DESC_USE_BINARY()
  2931. ###
  2932. ### Used in conjunction with BUILD_YDL_DESC. When enabled, all generated descriptors are binary.
  2933. ###
  2934. ### @example:
  2935. ###
  2936. ### PACKAGE()
  2937. ### YDL_DESC_USE_BINARY()
  2938. ### BUILD_YDL_DESC(../types.ydl Event Event.ydld)
  2939. ### END()
  2940. ###
  2941. ### This will generate descriptor Event.ydld in a binary format.
  2942. macro YDL_DESC_USE_BINARY() {
  2943. YDL_DESC_FLAGS_BINARY= --binary
  2944. SET_APPEND(YDL_DESC_FLAGS $YDL_DESC_FLAGS_BINARY)
  2945. }
  2946. ### @usage SRC(File Flags...)
  2947. ###
  2948. ### Compile single file with extra Flags.
  2949. ### Compilation is driven by the last extension of the File and Flags are specific to corresponding compilation command
  2950. macro SRC(FILE, FLAGS...) {
  2951. _SRC(${lastext:FILE} $FILE $FLAGS)
  2952. }
  2953. ### @usage: SRCS(<[GLOBAL] File> ...)
  2954. ###
  2955. ### Source files of the project. Files are built according to their extension and put int module output or fed to ultimate PROGRAM/DLL depending on GLOBAL presence.
  2956. ### Arcadia Paths from the root and is relative to the project's LIST are supported
  2957. ###
  2958. ### GLOBAL marks next file as direct input to link phase of the program/shared library project built into. This prevents symbols of the file to be excluded by linker as unused.
  2959. ### The scope of the GLOBAL keyword is the following file (that is, in the case of SRCS(GLOBAL foo.cpp bar.cpp) global will be only foo.cpp)
  2960. ###
  2961. ### @example:
  2962. ###
  2963. ### LIBRARY(test_global)
  2964. ### SRCS(GLOBAL foo.cpp)
  2965. ### END()
  2966. ###
  2967. ### This will produce foo.o and feed it to any PROGRAM/DLL module transitively depending on test_global library. The library itself will be empty and won't produce .a file.
  2968. macro SRCS(FILES...) {
  2969. foreach (FILE : $FILES) {
  2970. _SRC(${lastext:FILE} $FILE)
  2971. }
  2972. }
  2973. # tag:c-specific
  2974. macro _SRC_C_CUSTOM_FLAGS(SRC, COMPILE_OUT_SUFFIX, CUSTOM_FLAGS...) {
  2975. .CMD=$_SRC_c($SRC COMPILE_OUT_SUFFIX ${COMPILE_OUT_SUFFIX} ${CUSTOM_FLAGS})
  2976. .SEM=target_sources_custom $COMPILE_OUT_SUFFIX SRCS ${input:SRC} ${hide;output;suf=${COMPILE_OUT_SUFFIX}.o:SRC} CUSTOM_FLAGS $CUSTOM_FLAGS $USER_CONLYFLAGS $USER_CONLYFLAGS_GLOBAL
  2977. }
  2978. macro _SRC_CPP_CUSTOM_FLAGS(SRC, COMPILE_OUT_SUFFIX, CUSTOM_FLAGS...) {
  2979. .CMD=$_SRC_cpp($SRC COMPILE_OUT_SUFFIX ${COMPILE_OUT_SUFFIX} ${CUSTOM_FLAGS})
  2980. .SEM=target_sources_custom $COMPILE_OUT_SUFFIX SRCS ${input:SRC} ${hide;output;suf=${COMPILE_OUT_SUFFIX}.o:SRC} CUSTOM_FLAGS $CUSTOM_FLAGS
  2981. }
  2982. # tag:src-specific tag:cpp-specific
  2983. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  2984. ###
  2985. ### Defenition of generic macro. Report an error that the File with Ext is not
  2986. ### supported by macro MacroName if no appropriate macro specialization is found.
  2987. macro _SRC_CUSTOM_C_CPP(EXT, MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  2988. MESSAGE(FATAL_ERROR macro [[alt1]]$MACRO_NAME[[rst]] does not support files with [[imp]].$EXT[[rst]] extension)
  2989. }
  2990. # tag:src-specific tag:cpp-specific
  2991. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  2992. ###
  2993. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single C file (with .c extension)
  2994. macro _SRC_CUSTOM_C_CPP("c", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  2995. _SRC_C_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  2996. }
  2997. # tag:src-specific tag:cpp-specific
  2998. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  2999. ###
  3000. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cpp extension)
  3001. macro _SRC_CUSTOM_C_CPP("cpp", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  3002. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  3003. }
  3004. # tag:src-specific tag:cpp-specific
  3005. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  3006. ###
  3007. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cxx extension)
  3008. macro _SRC_CUSTOM_C_CPP("cxx", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  3009. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  3010. }
  3011. # tag:src-specific tag:cpp-specific
  3012. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  3013. ###
  3014. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .cc extension)
  3015. macro _SRC_CUSTOM_C_CPP("cc", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  3016. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  3017. }
  3018. # tag:src-specific tag:cpp-specific
  3019. ### @usage: _SRC_CUSTOM_C_CPP(Ext MacroName File Flags...) # internal
  3020. ###
  3021. ### Specialization of genreric macro _SRC_CUSTOM_C_CPP which compiles a single Cpp file (with .C extension)
  3022. macro _SRC_CUSTOM_C_CPP("C", MACRO_NAME, FILE, COMPILE_OUT_SUFFIX, FLAGS...) {
  3023. _SRC_CPP_CUSTOM_FLAGS($FILE $COMPILE_OUT_SUFFIX $FLAGS)
  3024. }
  3025. # tag:src-specific tag:cpp-specific tag:cpu
  3026. ### @uasge SRC_C_SSE2(File Flags...)
  3027. ###
  3028. ### Compile a single C/C++ file with SSE2 and additional Flags
  3029. macro SRC_C_SSE2(FILE, FLAGS...) {
  3030. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE2 $FILE .sse2 $SSE2_CFLAGS $FLAGS)
  3031. }
  3032. # tag:src-specific tag:cpp-specific tag:cpu
  3033. ### @uasge SRC_C_SSE3(File Flags...)
  3034. ###
  3035. ### Compile a single C/C++ file with SSE3 and additional Flags
  3036. macro SRC_C_SSE3(FILE, FLAGS...) {
  3037. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE3 $FILE .sse3 $SSE3_CFLAGS $FLAGS)
  3038. }
  3039. # tag:src-specific tag:cpp-specific tag:cpu
  3040. ### @uasge SRC_C_SSSE3(File Flags...)
  3041. ###
  3042. ### Compile a single C/C++ file with SSSE3 and additional Flags
  3043. macro SRC_C_SSSE3(FILE, FLAGS...) {
  3044. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSSE3 $FILE .ssse3 $SSSE3_CFLAGS $FLAGS)
  3045. }
  3046. # tag:src-specific tag:cpp-specific tag:cpu
  3047. ### @uasge SRC_C_SSE4(File Flags...)
  3048. ###
  3049. ### Compile a single C/C++ file with SSE4 and additional Flags
  3050. macro SRC_C_SSE4(FILE, FLAGS...) {
  3051. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE4 $FILE .sse4 $SSE4_CFLAGS $FLAGS)
  3052. }
  3053. # tag:src-specific tag:cpp-specific tag:cpu
  3054. ### @uasge SRC_C_SSE41(File Flags...)
  3055. ###
  3056. ### Compile a single C/C++ file with SSE4.1 and additional Flags
  3057. macro SRC_C_SSE41(FILE, FLAGS...) {
  3058. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_SSE41 $FILE .sse41 $SSE41_CFLAGS $FLAGS)
  3059. }
  3060. # tag:src-specific tag:cpp-specific tag:cpu
  3061. ### @uasge SRC_C_AVX(File Flags...)
  3062. ###
  3063. ### Compile a single C/C++ file with AVX and additional Flags
  3064. macro SRC_C_AVX(FILE, FLAGS...) {
  3065. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX $FILE .avx $AVX_CFLAGS $FLAGS)
  3066. }
  3067. # tag:src-specific tag:cpp-specific tag:cpu
  3068. ### @uasge SRC_C_AVX2(File Flags...)
  3069. ###
  3070. ### Compile a single C/C++ file with AVX2 and additional Flags
  3071. macro SRC_C_AVX2(FILE, FLAGS...) {
  3072. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX2 $FILE .avx2 $AVX2_CFLAGS $FLAGS)
  3073. }
  3074. # tag:src-specific tag:cpp-specific tag:cpu
  3075. ### @uasge SRC_C_AVX512(File Flags...)
  3076. ###
  3077. ### Compile a single C/C++ file with AVX512 and additional Flags
  3078. macro SRC_C_AVX512(FILE, FLAGS...) {
  3079. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AVX512 $FILE .avx512 $AVX512_CFLAGS $FLAGS)
  3080. }
  3081. # tag:src-specific tag:cpp-specific tag:cpu
  3082. ### @uasge SRC_C_AVX512(File Flags...)
  3083. ###
  3084. ### Compile a single C/C++ file with AVX512 and additional Flags
  3085. macro SRC_C_AMX(FILE, FLAGS...) {
  3086. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_AMX $FILE .amx $AMX_CFLAGS $FLAGS)
  3087. }
  3088. # tag:src-specific tag:cpp-specific tag:cpu
  3089. ### @uasge SRC_C_XOP(File Flags...)
  3090. ###
  3091. ### Compile a single C/C++ file with (an AMD-specific instruction set,
  3092. ### see https://en.wikipedia.org/wiki/XOP_instruction_set) and additional Flags
  3093. macro SRC_C_XOP(FILE, FLAGS...) {
  3094. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_XOP $FILE .xop $XOP_CFLAGS $FLAGS)
  3095. }
  3096. # tag:src-specific tag:cpp-specific tag:cpu
  3097. ### @uasge SRC_C_PCLMUL(File Flags...)
  3098. ###
  3099. ### Compile a single C/C++ file with PCLMUL and additional Flags
  3100. macro SRC_C_PCLMUL(FILE, FLAGS...) {
  3101. _SRC_CUSTOM_C_CPP(${lastext:FILE} SRC_C_PCLMUL $FILE .pclmul $PCLMUL_CFLAGS $FLAGS )
  3102. }
  3103. # tag:src-specific tag:cpp-specific
  3104. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  3105. ###
  3106. ### Defenition of generic macro. Report an error that the File with Ext is not
  3107. ### supported by macro MacroName if no appropriate macro specialization is found.
  3108. macro _SRC_STRICT_C_CPP(EXT, MACRO_NAME, FILE, FLAGS...) {
  3109. MESSAGE(FATAL_ERROR macro [[alt1]]$MACRO_NAME[[rst]] does not support files with [[imp]].$EXT[[rst]] extension)
  3110. }
  3111. # tag:src-specific tag:cpp-specific
  3112. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  3113. ###
  3114. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single C file (with .c extension)
  3115. macro _SRC_STRICT_C_CPP("c", MACRO_NAME, FILE, FLAGS...) {
  3116. _SRC(c $FILE $FLAGS)
  3117. }
  3118. # tag:src-specific tag:cpp-specific
  3119. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  3120. ###
  3121. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cpp extension)
  3122. macro _SRC_STRICT_C_CPP("cpp", MACRO_NAME, FILE, FLAGS...) {
  3123. _SRC(cpp $FILE $FLAGS)
  3124. }
  3125. # tag:src-specific tag:cpp-specific
  3126. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  3127. ###
  3128. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cxx extension)
  3129. macro _SRC_STRICT_C_CPP("cxx", MACRO_NAME, FILE, FLAGS...) {
  3130. _SRC(cpp $FILE $FLAGS)
  3131. }
  3132. # tag:src-specific tag:cpp-specific
  3133. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  3134. ###
  3135. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .cc extension)
  3136. macro _SRC_STRICT_C_CPP("cc", MACRO_NAME, FILE, FLAGS...) {
  3137. _SRC(cpp $FILE $FLAGS)
  3138. }
  3139. # tag:src-specific tag:cpp-specific
  3140. ### @usage: _SRC_STRICT_C_CPP(Ext MacroName File Flags...) # internal
  3141. ###
  3142. ### Specialization of genreric macro _SRC_STRICT_C_CPP which compiles a single Cpp file (with .C extension)
  3143. macro _SRC_STRICT_C_CPP("C", MACRO_NAME, FILE, FLAGS...) {
  3144. _SRC(cpp $FILE $FLAGS)
  3145. }
  3146. # tag:src-specific tag:cpp-specific
  3147. ### @uasge SRC_C_PIC(File Flags...)
  3148. ###
  3149. ### Compile a single C/C++ file with -fPIC and additional Flags
  3150. macro SRC_C_PIC(FILE, FLAGS...) {
  3151. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_PIC $FILE $PIC_CFLAGS $FLAGS)
  3152. }
  3153. # tag:src-specific tag:cpp-specific
  3154. ### @uasge SRC_C_NO_LTO(File Flags...)
  3155. ###
  3156. ### Compile a single C/C++ file with link-time-optimization disabling and additional Flags
  3157. macro SRC_C_NO_LTO(FILE, FLAGS...) {
  3158. _SRC_STRICT_C_CPP(${lastext:FILE} SRC_C_NO_LTO $FILE $NO_LTO_CFLAGS $FLAGS)
  3159. }
  3160. # tag:python-processing tag:cython
  3161. # TODO: use it in [.pyx] cmd
  3162. ### @usage: BUILDWITH_CYTHON_CPP(Src Options...)
  3163. ###
  3164. ### Generates .cpp file from .pyx.
  3165. macro BUILDWITH_CYTHON_CPP(Src, Options...) {
  3166. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir;suf=${OBJ_SUF}.cpp:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  3167. .SEM=target_cython_sources PRIVATE ${input:Src} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  3168. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3169. }
  3170. # tag:python-processing tag:cython tag:internal
  3171. ### @usage: _BUILDWITH_CYTHON_CPP_DEP(Src Dep Options...) # internal
  3172. ###
  3173. ### Generates .cpp file from .pyx and attach extra input Dep.
  3174. ### If Dep changes the .cpp file will be re-generated.
  3175. macro _BUILDWITH_CYTHON_CPP_DEP(Src, Dep, Options...) {
  3176. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;tobindir;suf=${OBJ_SUF}.cpp:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  3177. .SEM=target_cython_sources PRIVATE ${input:Src} ${input;hide:Dep} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  3178. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3179. }
  3180. # tag:python-processing tag:cython tag:internal
  3181. ### @usage: _BUILDWITH_CYTHON_CPP_H(Src Dep Options...) # internal
  3182. ###
  3183. ### BUILDWITH_CYTHON_CPP without .pyx infix and with cdef public .h file.
  3184. macro _BUILDWITH_CYTHON_CPP_H(Src, Dep, Options...) {
  3185. .CMD=$RUN_CYTHON_SCRIPT_H $CYTHON_OPTIONS ${Options} --cplus ${CYTHON_CPP_OUTPUT_INCLUDES} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.cpp} ${output;hide;addincl;noext;tobindir:Src.h} ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  3186. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3187. }
  3188. # tag:python-processing tag:cython
  3189. ### @usage: BUILDWITH_CYTHON_C(Src Options...)
  3190. ###
  3191. ### Generates .c file from .pyx.
  3192. macro BUILDWITH_CYTHON_C(Src, Options...) {
  3193. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} -o ${output;tobindir;suf=${OBJ_SUF}.c:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  3194. .SEM=target_cython_sources PRIVATE ${input:Src} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} ${CYTHON_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  3195. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3196. }
  3197. # tag:python-processing tag:cython tag:internal
  3198. ### @usage: _BUILDWITH_CYTHON_C_DEP(Src Dep Options...) # internal
  3199. ###
  3200. ### Generates .c file from .pyx and attach extra input Dep.
  3201. ### If Dep changes the .c file will be re-generated.
  3202. macro _BUILDWITH_CYTHON_C_DEP(Src, Dep, Options...) {
  3203. .CMD=$RUN_CYTHON_SCRIPT $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;tobindir;suf=${OBJ_SUF}.c:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  3204. .SEM=target_cython_sources PRIVATE ${input:Src} ${input;hide:Dep} ${output;hide;tobindir:Src.fake.o} && target_cython_options $CYTHON_OPTIONS ${Options} ${CYTHON_OUTPUT_INCLUDES} && target_cython_include_directories $_CYTHON__INCLUDE && set_python_type_for_cython $PYTHON_TYPE_FOR_CYTHON
  3205. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3206. }
  3207. # tag:python-processing tag:cython tag:internal
  3208. ### @usage: _BUILDWITH_CYTHON_C_H(Src Dep Options...) # internal
  3209. ###
  3210. ### BUILDWITH_CYTHON_C without .pyx infix and with cdef public .h file.
  3211. macro _BUILDWITH_CYTHON_C_H(Src, Dep, Options...) {
  3212. .CMD=$RUN_CYTHON_SCRIPT_H $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.c} ${output;hide;addincl;noext;tobindir:Src.h} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  3213. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3214. }
  3215. # tag:python-processing tag:cython tag:internal
  3216. ### @usage: _BUILDWITH_CYTHON_C_API_H(Src Dep Options...) # internal
  3217. ###
  3218. ### BUILDWITH_CYTHON_C_H with cdef api _api.h file.
  3219. macro _BUILDWITH_CYTHON_C_API_H(Src, Dep, Options...) {
  3220. .CMD=$RUN_CYTHON_SCRIPT_H $CYTHON_OPTIONS ${Options} ${pre=-I:_CYTHON__INCLUDE} ${input:Src} ${input;hide:Dep} -o ${output;noext;tobindir:Src.c} ${output;hide;addincl;noext;tobindir:Src.h} ${output;hide;addincl;noext;defext=_api.h;tobindir:Src} $CYTHON_OUTPUT_INCLUDES ${kv;hide:"p CY"} ${kv;hide:"pc yellow"}
  3221. ADDINCL(FOR cython contrib/tools/cython/Cython/Includes)
  3222. }
  3223. ### @usage: BUILDWITH_RAGEL6(Src Options...)
  3224. ###
  3225. ### Compile .rl file using Ragel6.
  3226. macro BUILDWITH_RAGEL6(Src, Options...) {
  3227. .CMD=$RUN_NO_SANITIZE ${tool:"contrib/tools/ragel6"} $RAGEL6_FLAGS ${Options} -I${ARCADIA_ROOT} -o ${output;nopath;noext;defext=.rl6.cpp:Src} ${input:Src} ${kv;hide:"p R6"} ${kv;hide:"pc yellow"}
  3228. }
  3229. # tag:python-processing tag:internal
  3230. # TODO: use it in [.pyx] cmd
  3231. ### @usage: _PY_REGISTER() # internal
  3232. ###
  3233. ### Register Python 2.x module in internal resource file system. Arcadia Python 2.x importer will be retrieve these on import directive.
  3234. ###
  3235. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  3236. macro _PY_REGISTER(Func) {
  3237. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py_reg.py"} $Func ${output;noauto:Func.reg.cpp} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  3238. SRCS(GLOBAL $Func.reg.cpp)
  3239. }
  3240. # tag:python-processing tag:internal
  3241. ### @usage: _PY3_REGISTER() # internal
  3242. ###
  3243. ### Register Python 3.x module in internal resource file system. Arcadia Python 3.x importer will be retrieve these on import directive
  3244. ###
  3245. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  3246. macro _PY3_REGISTER(Func) {
  3247. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_py3_reg.py"} $Func ${output;noauto:Func.reg3.cpp} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  3248. SRCS(GLOBAL $Func.reg3.cpp)
  3249. }
  3250. # tag:python-processing tag:internal
  3251. ### @usage: _PY_COMPILE_BYTECODE(SrcX Src) # internal
  3252. ###
  3253. ### Compile Python 2.x .py source file into Arcadia binary form suitable for PY2_PROGRAM
  3254. ###
  3255. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  3256. macro _PY_COMPILE_BYTECODE(SrcX, Src, Dst) {
  3257. .CMD=$YMAKE_PYTHON ${input:"build/scripts/py_compile.py"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  3258. }
  3259. # tag:python-processing tag:internal
  3260. ### @usage: _PY3_COMPILE_BYTECODE(SrcX Src) # internal
  3261. ###
  3262. ### Compile Python 3.x .py source file into Arcadia binary form suitable for PY3_PROGRAM
  3263. ###
  3264. ### Documentation: https://wiki.yandex-team.ru/devtools/commandsandvars/pysrcs/#makrospyregister
  3265. macro _PY3_COMPILE_BYTECODE(SrcX, Src, Dst) {
  3266. .CMD=${env:"PYTHONHASHSEED=0"} ${tool:"tools/py3cc"} $SrcX ${input:Src} ${output;noauto:Dst.yapyc3} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"}
  3267. }
  3268. macro _ARCHIVE_SEM_HELPER(FLAGS[], OUT, Files...) {
  3269. .SEM=add_custom_command OUTPUT ${OUT} DEPENDS $ARCH_TOOL ${join= :Files} COMMAND $ARCH_TOOL $FLAGS ${join=\: :Files}: -o ${OUT}
  3270. }
  3271. ### @usage: ARCHIVE_ASM(NAME archive_name files...)
  3272. ###
  3273. ### Similar to the macro ARCHIVE, but:
  3274. ### 1. works faster and it is better to use for large files.
  3275. ### 2. Different syntax (see examples in codesearch or users/pg/tests/archive_test)
  3276. macro ARCHIVE_ASM(NAME="", DONTCOMPRESS?"-p":"", Files...) {
  3277. .CMD=$ARCH_TOOL -q $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;suf=$OBJ_SUF.rodata:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-cyan"}
  3278. .SEM=$_ARCHIVE_SEM_HELPER(${output;suf=$OBJ_SUF.rodata:NAME} ${input:Files} FLAGS -q $DONTCOMPRESS)
  3279. }
  3280. # tag:yweb-specific
  3281. macro PIRE_INLINE_CMD(SRC) {
  3282. .CMD=${tool:"library/cpp/regex/pire/inline"} -o ${output:SRC} ${input:SRC} ${output_include;hide:SRC} ${kv;hide:"p PI"} ${kv;hide:"pc yellow"}
  3283. }
  3284. # tag:yweb-specific
  3285. macro PIRE_INLINE(FILES...) {
  3286. foreach (FILE : $FILES) {
  3287. PIRE_INLINE_CMD($FILE)
  3288. }
  3289. }
  3290. ### @usage: ARCHIVE(archive_name [DONT_COMPRESS] files...)
  3291. ###
  3292. ### Add arbitrary data to a modules. Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  3293. ###
  3294. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  3295. macro ARCHIVE(NAME="", DONTCOMPRESS?"-p":"", Files...) {
  3296. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input;join=\: :Files}: -o ${output;addincl;noauto:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  3297. .SEM=$_ARCHIVE_SEM_HELPER(${output;addincl;noauto:NAME} ${input:Files} FLAGS -q -x $DONTCOMPRESS) && target_sources PRIVATE $BINDIR/$NAME
  3298. }
  3299. ### @usage: ARCHIVE_BY_KEYS(archive_name key [DONT_COMPRESS] files...)
  3300. ###
  3301. ### Add arbitrary data to a module be accessible by specified key.
  3302. ### Unlike RESOURCE macro the result should be futher processed by othet macros in the module.
  3303. ###
  3304. ### Example: https://wiki.yandex-team.ru/yatool/howtowriteyamakefiles/#a1ispolzujjtekomanduarchive
  3305. macro ARCHIVE_BY_KEYS(NAME="", KEYS="", DONTCOMPRESS?"-p":"", Files...) {
  3306. .CMD=$ARCH_TOOL -q -x $DONTCOMPRESS ${input:Files} -k $KEYS -o ${output;addincl;noauto:NAME} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  3307. }
  3308. #scripts
  3309. #special commands
  3310. BUILDVERSION_SCRIPT=build/scripts/build_info_gen.py
  3311. SVNVERSION_JAVA_MARKER=output-java-class
  3312. SVNVERSION_GO_MARKER=output-go
  3313. VCS_C_OBJ=$BINDIR/__vcs_version__.c$OBJECT_SUF
  3314. VCS_C_OBJ_RR=$MODDIR/__vcs_version__.c$OBJECT_SUF
  3315. VCS_C=$BINDIR/__vcs_version__.c
  3316. VCS_GO=$BINDIR/__vcs_version__.go
  3317. VCS_JAVA=$BINDIR/__vcs_version__.mf
  3318. VCS_INFO_DISABLE_CACHE__NO_UID__=
  3319. YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  3320. CL_DEBUG_INFO_DISABLE_CACHE__NO_UID__=
  3321. CL_MACRO_INFO_DISABLE_CACHE__NO_UID__=
  3322. YASM_DEBUG_INFO=
  3323. CL_DEBUG_INFO=
  3324. CL_MACRO_INFO=
  3325. when ($FORCE_VCS_INFO_UPDATE == "yes") {
  3326. VCS_INFO_DISABLE_CACHE__NO_UID__=${hide;kv:"disable_cache"}
  3327. }
  3328. ### Works for pyton too.
  3329. GENERATE_VCS_C_INFO_NODEP=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} $(VCS)/vcs.json $VCS_C ${input:"build/scripts/c_templates/svn_interface.c"} $VCS_INFO_DISABLE_CACHE__NO_UID__ && $_SRC_c_nodeps($VCS_C, $VCS_C_OBJ, $(SOURCE_ROOT))
  3330. GENERATE_VCS_GO_INFO_NODEP=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-go $(VCS)/vcs.json $VCS_GO $GO_ARCADIA_PROJECT_PREFIX $VCS_INFO_DISABLE_CACHE__NO_UID__
  3331. GENERATE_VCS_JAVA_INFO_NODEP=$YMAKE_PYTHON ${input:"build/scripts/vcs_info.py"} output-java $(VCS)/vcs.json $VCS_JAVA $VCS_INFO_DISABLE_CACHE__NO_UID__
  3332. macro UPDATE_VCS_JAVA_INFO_NODEP(Jar) {
  3333. .CMD=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-java $(VCS)/vcs.json $VCS_JAVA $Jar $VCS_INFO_DISABLE_CACHE__NO_UID__
  3334. }
  3335. VCS_INFO_FILE=
  3336. ### @usage VCS_INFO_FILE([FILE out_file])
  3337. ###
  3338. ### Enable saving vcs info as a json-file into PACKAGE
  3339. ###
  3340. ### Info is saved to 'vcs_info.json' by default.
  3341. ### Use FILE parameter if you want another name.
  3342. ###
  3343. ### Note: macro can be used only once per module
  3344. macro VCS_INFO_FILE(FILE="vcs_info.json") {
  3345. SET(VCS_INFO_FILE $FILE)
  3346. }
  3347. ADD_VCS_INFO_FILE_CMD=
  3348. when ($VCS_INFO_FILE) {
  3349. ADD_VCS_INFO_FILE_CMD=$YMAKE_PYTHON3 ${input:"build/scripts/vcs_info.py"} output-json $(VCS)/vcs.json ${output:VCS_INFO_FILE} $VCS_INFO_DISABLE_CACHE__NO_UID__
  3350. }
  3351. ### @usage: CREATE_BUILDINFO_FOR(GenHdr)
  3352. ###
  3353. ### Creates header file to access some information about build specified via configuration variables.
  3354. ### Unlike CREATE_SVNVERSION_FOR() it doesn't take revion information from VCS, it uses revision and SandboxTaskId passed via -D options to ya make
  3355. macro CREATE_BUILDINFO_FOR(GenHdr) {
  3356. .CMD=$YIELD $CXX_COMPILER && $YIELD $CXXFLAGS && $XARGS $YMAKE_PYTHON3 ${input:BUILDVERSION_SCRIPT} ${output:GenHdr} ${kv;hide:"p BI"} ${kv;hide:"pc yellow"} ${hide;kv:"show_out"} $SVN_DEPENDS_CACHE__NO_UID__
  3357. .SEM=$RUN_PYTHON3($BUILDVERSION_SCRIPT $GenHdr \\\"${CMAKE_CXX_COMPILER}\\\" \\\"${CMAKE_CXX_FLAGS}\\\" OUT $GenHdr)
  3358. }
  3359. DECIMAL_MD5_SCRIPT=build/scripts/decimal_md5.py
  3360. DECIMAL_MD5_FIXED=
  3361. ### @usage: DECIMAL_MD5_LOWER_32_BITS(<fileName> [FUNCNAME funcName] [inputs...])
  3362. ###
  3363. ### Generates .cpp file <fileName> with one defined function 'const char* <funcName>() { return "<calculated_md5_hash>"; }'.
  3364. ### <calculated_md5_hash> will be md5 hash for all inputs passed to this macro.
  3365. macro DECIMAL_MD5_LOWER_32_BITS(File, FUNCNAME="", Opts...) {
  3366. .CMD=$YMAKE_PYTHON ${input:DECIMAL_MD5_SCRIPT} --fixed-output=${DECIMAL_MD5_FIXED} --func-name=${FUNCNAME} --lower-bits 32 --source-root=$ARCADIA_ROOT ${input;context=TEXT:Opts} ${output;stdout:File} ${kv;hide:"p SV"} ${kv;hide:"pc yellow"} ${hide;kv:"show_out"}
  3367. }
  3368. # tag:internal
  3369. ### @usage $CFG_VARS # internal
  3370. ###
  3371. ### Mark commands that embed Configuration variables into files
  3372. macro CFG_VARS() {
  3373. .GEN_FROM_FILE=yes
  3374. }
  3375. ### @usage: CONFIGURE_FILE(from to)
  3376. ###
  3377. ### Copy file with the replacement of configuration variables in form of @ANY_CONF_VAR@ with their values.
  3378. ### The values are collected during configure stage, while replacement itself happens during build stage.
  3379. ### Used implicitly for .in-files processing.
  3380. macro CONFIGURE_FILE(Src, Dst) {
  3381. .CMD=$YMAKE_PYTHON ${input:"build/scripts/configure_file.py"} ${input:Src} ${output;addincl:Dst} $CFG_VARS ${kv;hide:"p CF"} ${kv;hide:"pc yellow"}
  3382. .SEM=set_vars ${CFG_VARS} && configure_file $S/${input;rootrel:Src} $B/${output;addincl;rootrel:Dst}
  3383. }
  3384. ### @usage: BASE_CODEGEN(tool_path prefix)
  3385. ###
  3386. ### Generator ${prefix}.cpp + ${prefix}.h files based on ${prefix}.in.
  3387. macro BASE_CODEGEN(Tool, Prefix, Opts...) {
  3388. .CMD=${tool:Tool} ${input:Prefix.in} ${output;nopath;noauto:Prefix.cpp} ${output;nopath:Prefix.h} $Opts ${kv;hide:"p BC"} ${kv;hide:"pc yellow"}
  3389. }
  3390. # tag:internal
  3391. ### @usage: _SPLIT_CODEGEN_BASE(tool prefix OUTS[] OUTPUT_INCLUDES[]) # internal
  3392. ###
  3393. ### Generator of a certain number .the. cpp file + one header .h file from .in.
  3394. ### This is the call of the generator. Python macro SPLIT_CODEGEN() is defined in order to properly fill command outputs from OUT_NUM argument.
  3395. macro _SPLIT_CODEGEN_BASE(Tool, Prefix, OUT[], OPTS[], OUTPUT_INCLUDES[]) {
  3396. .CMD=${tool:Tool} ${input:Prefix.in} ${output;hide:OUT} ${output;nopath;noauto:Prefix.cpp} ${output;nopath:Prefix.h} $OPTS ${output_include;hide:OUTPUT_INCLUDES} ${kv;hide:"p SC"} ${kv;hide:"pc yellow"}
  3397. }
  3398. STRUCT_CODEGEN_OUTPUT_INCLUDES=${output_include;hide:"util/generic/singleton.h"} \
  3399. ${output_include;hide:"util/generic/strbuf.h"} \
  3400. ${output_include;hide:"util/generic/vector.h"} \
  3401. ${output_include;hide:"util/generic/ptr.h"} \
  3402. ${output_include;hide:"util/generic/yexception.h"} \
  3403. ${output_include;hide:"kernel/struct_codegen/reflection/reflection.h"} \
  3404. ${output_include;hide:"kernel/struct_codegen/reflection/floats.h"}
  3405. ### @usage: STRUCT_CODEGEN(Prefix)
  3406. ### A special case BASE_CODEGEN, in which the kernel/struct_codegen/codegen_tool tool is used.
  3407. macro STRUCT_CODEGEN(Prefix) {
  3408. .CMD=$BASE_CODEGEN(kernel/struct_codegen/codegen_tool, $Prefix, $STRUCT_CODEGEN_OUTPUT_INCLUDES)
  3409. .PEERDIR=kernel/struct_codegen/metadata kernel/struct_codegen/reflection
  3410. }
  3411. ### @usage: DUMPERF_CODEGEN(Prefix)
  3412. ### A special case BASE_CODEGEN, in which the extsearch/images/robot/tools/dumperf/codegen tool is used
  3413. macro DUMPERF_CODEGEN(Prefix) {
  3414. .CMD=$BASE_CODEGEN(extsearch/images/robot/tools/dumperf/codegen, $Prefix, ${output_include;hide:"extsearch/images/kernel/erf/erf_format.h"})
  3415. }
  3416. # tag:flags
  3417. ### @usage: LDFLAGS(LinkerFlags...)
  3418. ###
  3419. ### Add flags to the link command line of executable or shared library/dll.
  3420. ### Note: LDFLAGS are always global. When set in the LIBRARY module they will affect all programs/dlls/tests the library is linked into.
  3421. ### Note: remember about the incompatibility of flags for gcc and cl.
  3422. macro LDFLAGS(Flags...) {
  3423. SET_APPEND(LDFLAGS_GLOBAL $Flags)
  3424. }
  3425. # tag:flags
  3426. ### @usage: CFLAGS([GLOBAL compiler_flag]* compiler_flags)
  3427. ###
  3428. ### Add the specified flags to the compilation command of C and C++ files.
  3429. ### @params: GLOBAL - Propagates these flags to dependent projects
  3430. ### Note: remember about the incompatibility flags for clang and cl (to set flags specifically for cl.exe use MSVC_FLAGS).
  3431. macro CFLAGS(Flags...) {
  3432. SET_APPEND_WITH_GLOBAL(USER_CFLAGS $Flags)
  3433. }
  3434. # tag:flags
  3435. ### @usage: MASMFLAGS(compiler flags)
  3436. ### Add the specified flags to the compilation command of .masm files.
  3437. macro MASMFLAGS(Flags...) {
  3438. SET_APPEND(MASMFLAGS $Flags)
  3439. }
  3440. # tag:flags
  3441. ### @usage: CONLYFLAGS([GLOBAL compiler_flag]* compiler_flags)
  3442. ### Add the specified flags to the compilation command of .c (but not .cpp) files.
  3443. ### @params: GLOBAL - Distributes these flags on dependent projects
  3444. macro CONLYFLAGS(Flags...) {
  3445. SET_APPEND_WITH_GLOBAL(USER_CONLYFLAGS $Flags)
  3446. }
  3447. # tag:flags
  3448. ### @usage: CXXFLAGS(compiler_flags)
  3449. ### Add the specified flags to the compilation command of .cpp (but not .c) files.
  3450. macro CXXFLAGS(Flags...) {
  3451. SET_APPEND_WITH_GLOBAL(USER_CXXFLAGS $Flags)
  3452. }
  3453. # tag:flags
  3454. ### @usage: CUDA_NVCC_FLAGS(compiler flags)
  3455. ### Add the specified flags to the compile line .cu-files.
  3456. macro CUDA_NVCC_FLAGS(Flags...) {
  3457. SET_APPEND(CUDA_NVCC_FLAGS $Flags)
  3458. }
  3459. # tag:flags
  3460. ### @usage: NVCC_DEVICE_LINK(file.cu...)
  3461. ### Run nvcc --device-link on objects compiled from srcs with --device-c.
  3462. ### This generates a stub object devlink.o that supplies missing pieces for the
  3463. ### host linker to link relocatable device objects into the final executable.
  3464. macro NVCC_DEVICE_LINK(Srcs...) {
  3465. .CMD=$NVCC $NVCC_FLAGS -o ${output;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:"devlink"} -dlink ${input;suf=${OBJ_SUF}${NVCC_OBJ_EXT}:Srcs} ${kv;hide:"p DL"} ${kv;hide:"pc light-blue"}
  3466. }
  3467. # tag:flags
  3468. ### @usage: CYTHON_FLAGS(compiler_flags)
  3469. ### Add the specified flags to the compilation command of .pyx files.
  3470. macro CYTHON_FLAGS(Flags...) {
  3471. SET_APPEND(CYTHON_OPTIONS $Flags)
  3472. }
  3473. ### @usage: STRIP()
  3474. ### Strip debug info from a PROGRAM, DLL or TEST.
  3475. ### This macro doesn't work in LIBRARY's, UNION's and PACKAGE's.
  3476. macro STRIP() {
  3477. ENABLE(STRIP)
  3478. }
  3479. ### @usage: NO_OPTIMIZE()
  3480. ### Build code without any optimizations (-O0 mode).
  3481. macro NO_OPTIMIZE() {
  3482. ENABLE(NO_OPTIMIZE)
  3483. }
  3484. #TODO(YMAKE-91) read proper compile flags instead of sending explicit flags to semgraph directly
  3485. _SEM_EXTRA_CXX_FLAGS=
  3486. ### @usage: NO_COMPILER_WARNINGS()
  3487. ### Disable all compiler warnings in the module.
  3488. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  3489. macro NO_COMPILER_WARNINGS() {
  3490. ENABLE(NO_COMPILER_WARNINGS)
  3491. SET(_SEM_EXTRA_CXX_FLAGS "$<IF:$<CXX_COMPILER_ID:MSVC>,,-Wno-everything>")
  3492. }
  3493. ### @usage: WERROR()
  3494. ### Consider warnings as errors in the current module.
  3495. ### In the bright future will be removed, since WERROR is the default.
  3496. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  3497. macro WERROR() {
  3498. ENABLE(WERROR)
  3499. }
  3500. ### @usage: NO_WERROR()
  3501. ### Override WERROR() behavior
  3502. ### Priorities: NO_COMPILER_WARNINGS > NO_WERROR > WERROR_MODE > WERROR.
  3503. macro NO_WERROR() {
  3504. DISABLE(WERROR)
  3505. }
  3506. ### @usage: NO_WSHADOW()
  3507. ### Disable C++ shadowing warnings.
  3508. macro NO_WSHADOW() {
  3509. ENABLE(NO_WSHADOW)
  3510. }
  3511. # tag:internal
  3512. ### @usage: NO_PLATFORM_RESOURCES() # internal
  3513. ### Exclude dependency on platform resources libraries.
  3514. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  3515. macro NO_PLATFORM_RESOURCES() {
  3516. ENABLE(NOPLATFORM_RESOURCES)
  3517. }
  3518. # tag:internal tag:codenav
  3519. ### @usage: NO_CODENAVIGATION() # internal
  3520. ### Disable codenaviagtion for a module. Needed to avoid PEERDIR loops in codenavigation support.
  3521. ### Most probably you'll never need this. If you think you need, please contact devtools@ for assistance.
  3522. macro NO_CODENAVIGATION() {
  3523. ENABLE(NOCODENAVIGATION)
  3524. }
  3525. ### @usage: NO_UTIL()
  3526. ### Build module without dependency on util.
  3527. ### Note: use this with care. Util most likely will be linked into executable anyway,
  3528. ### so using util headers/functions/classes may not be detected at build time and may lead to unpredictable behavors at configure time.
  3529. macro NO_UTIL() {
  3530. ENABLE(NOUTIL)
  3531. }
  3532. ### @usage: NO_RUNTIME()
  3533. ###
  3534. ### This macro:
  3535. ### 1. Sets the ENABLE(NOUTIL) + DISABLE(USE_INTERNAL_STL);
  3536. ### 2. If the project that contains the macro NO_RUNTIME(), peerdir-it project does not contain NO_RUNTIME() => Warning.
  3537. ### Note: use this with care. Arcadia STL most likely will be linked into executable anyway, so using STL headers/functions/classes
  3538. ### may not be detected at build time and may lead to unpredictable behavors at configure time.
  3539. macro NO_RUNTIME() {
  3540. SET(USE_ARCADIA_LIBM no)
  3541. NO_UTIL()
  3542. ENABLE(NORUNTIME)
  3543. }
  3544. ### @usage: NO_LIBC()
  3545. ###
  3546. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata).
  3547. ### Note: use this with care. libc most likely will be linked into executable anyway,
  3548. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  3549. macro NO_LIBC() {
  3550. NO_RUNTIME()
  3551. DISABLE(MUSL)
  3552. }
  3553. ### @usage: NO_PLATFORM()
  3554. ###
  3555. ### Exclude dependencies on C++ and C runtimes (including util, musl and libeatmydata) and set NO_PLATFORM variable for special processing.
  3556. ### Note: use this with care. libc most likely will be linked into executable anyway,
  3557. ### so using libc headers/functions may not be detected at build time and may lead to unpredictable behavors at configure time.
  3558. macro NO_PLATFORM() {
  3559. NO_LIBC()
  3560. ENABLE(NOPLATFORM)
  3561. }
  3562. # tag:cpp-specific
  3563. ### @usage: USE_CXX()
  3564. ###
  3565. ### Add dependency on C++ runtime
  3566. ### Note: This macro is inteneded for use in _GO_BASE_UNIT like module when the module is built without C++ runtime by default
  3567. macro USE_CXX() {
  3568. DISABLE(NORUNTIME)
  3569. }
  3570. ### @usage: USE_UTIL()
  3571. ###
  3572. ### Add dependency on util and C++ runtime
  3573. ### Note: This macro is intended for use in _GO_BASE_UNIT like module when the module is build without util by default
  3574. macro USE_UTIL() {
  3575. USE_CXX()
  3576. DISABLE(NOUTIL)
  3577. }
  3578. ### @usage: USE_NASM()
  3579. ###
  3580. ### Build only .asm files with nasm toolchain instead of yasm
  3581. ### Add to ya.make file ADDINCL(asm ...) with all folders where .asm files include smth
  3582. macro USE_NASM() {
  3583. ENABLE(USE_NASM_ASSEMBLER)
  3584. PEERDIR(build/external_resources/nasm)
  3585. }
  3586. # tag:deprecated
  3587. ### @usage: NO_JOIN_SRC() # deprecated, does-nothing
  3588. ### This macro currently does nothing. This is default behavior which cannot be overridden at module level.
  3589. macro NO_JOIN_SRC() {
  3590. ENABLE(UNUSED_MACRO)
  3591. }
  3592. # tag:sanitize
  3593. ### @usage: NO_SANITIZE()
  3594. ###
  3595. ### Disable all sanitizers for the module.
  3596. macro NO_SANITIZE() {
  3597. DISABLE(SANITIZER_TYPE)
  3598. }
  3599. # tag:coverage tag:sanitize
  3600. ### @usage: NO_SANITIZE_COVERAGE()
  3601. ###
  3602. ### Disable lightweight coverage (-fsanitize-coverage) for the module.
  3603. ### Sanitize coverage is commonly used with fuzzing.
  3604. ### It might be useful to disable it for libraries that should never
  3605. ### be the main targets for fuzzing, like libfuzzer library itself.
  3606. ### Sanitize coverage instrumentation is enabled by the --sanitize-coverage option.
  3607. macro NO_SANITIZE_COVERAGE() {
  3608. DISABLE(SANITIZE_COVERAGE)
  3609. }
  3610. # tag:coverage
  3611. ### @usage: NO_CLANG_COVERAGE()
  3612. ###
  3613. ### Disable heavyweight clang coverage for the module. Clang coverage instrumentation is enabled by the --clang-coverage option.
  3614. macro NO_CLANG_COVERAGE() {
  3615. DISABLE(CLANG_COVERAGE)
  3616. }
  3617. macro NO_CLANG_TIDY() {
  3618. DISABLE(TIDY_ENABLED)
  3619. }
  3620. # tag:lua-specific
  3621. LUAJIT_PATH=${ARCADIA_ROOT}/contrib/libs/luajit
  3622. macro _LUAJIT_OBJDUMP(Src, OUT="") {
  3623. .CMD=${cwd:LUAJIT_PATH} ${tool:"contrib/libs/luajit/compiler"} -b -g ${input:Src} ${output;noauto:OUT} ${kv;hide:"p LJ"} ${kv;hide:"pc light-cyan"}
  3624. }
  3625. # tag:lua-specific
  3626. LUAJIT_21_PATH=${ARCADIA_ROOT}/contrib/libs/luajit_21
  3627. macro _LUAJIT_21_OBJDUMP(Src, OUT="") {
  3628. .CMD=${cwd:LUAJIT_21_PATH} ${tool:"contrib/libs/luajit_21/compiler"} -b -g ${input:Src} ${output;noauto:OUT} ${kv;hide:"p LJ"} ${kv;hide:"pc light-cyan"}
  3629. }
  3630. # tag:lua-specific
  3631. LUAJIT_OPENRESTY_PATH=${ARCADIA_ROOT}/contrib/libs/luajit_openresty
  3632. macro _LUAJIT_OPENRESTY_OBJDUMP(Src, OUT="") {
  3633. .CMD=${cwd:LUAJIT_OPENRESTY_PATH} ${tool:"contrib/libs/luajit_openresty/compiler"} -b -g ${input:Src} ${output;noauto:OUT} ${kv;hide:"p LJ"} ${kv;hide:"pc light-cyan"}
  3634. }
  3635. RELEV_FML_CODEGEN_INCLS=${output_include;hide:"kernel/relevfml/relev_fml.h"} ${output_include;hide:"library/cpp/sse/sse.h"}
  3636. ### @usage: GENERATE_ENUM_SERIALIZATION(File.h)
  3637. ###
  3638. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module.
  3639. ###
  3640. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  3641. macro GENERATE_ENUM_SERIALIZATION(File) {
  3642. .CMD=$ENUM_PARSER_TOOL ${input:File} --include-path ${input;rootrel:File} --output ${output;suf=_serialized.cpp:File} ${output_include;from_input;hide:File} ${output_include;hide:"util/generic/serialized_enum.h"} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  3643. .SEM=generate_enum_serilization ${input:File} ${output;hide;suf=_serialized.o:File} INCLUDE_HEADERS ${input;rootrel:File} ${tool;hide:"tools/enum_parser/enum_parser"}
  3644. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  3645. }
  3646. ### @usage: GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File.h)
  3647. ###
  3648. ### Create serialization support for enumeration members defined in the header (String <-> Enum conversions) and compile it into the module
  3649. ### Provide access to serialization functions via generated header File_serialized.h
  3650. ###
  3651. ### Documentation: https://wiki.yandex-team.ru/yatool/HowToWriteYaMakeFiles/
  3652. macro GENERATE_ENUM_SERIALIZATION_WITH_HEADER(File) {
  3653. .CMD=$ENUM_PARSER_TOOL ${input:File} --include-path ${input;rootrel:File} --output ${output;suf=_serialized.cpp:File} --header ${output;suf=_serialized.h:File} ${output_include;from_input;hide:File} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  3654. .SEM=generate_enum_serilization ${input:File} ${output;hide;suf=_serialized.o:File} GEN_HEADER ${output;suf=_serialized.h:File} INCLUDE_HEADERS ${input;rootrel:File} ${tool;hide:"tools/enum_parser/enum_parser"}
  3655. PEERDIR(tools/enum_parser/enum_serialization_runtime)
  3656. }
  3657. ### @usage: DEB_VERSION(File)
  3658. ###
  3659. ### Creates a header file DebianVersion.h define the DEBIAN_VERSION taken from the File.
  3660. macro DEB_VERSION(File) {
  3661. .CMD=$YMAKE_PYTHON ${input:"build/scripts/mkver.py"} ${input:File} ${output;stdout:"DebianVersion.h"} ${kv;hide:"p CL"} ${kv;hide:"pc yellow"}
  3662. }
  3663. ### @usage: NEED_CHECK()
  3664. ###
  3665. ### Commits to the project marked with this macro will be blocked by pre-commit check and then will be
  3666. ### automatically merged to trunk only if there is no new broken build targets in check results.
  3667. ### The use of this macro is disabled by default.
  3668. macro NEED_CHECK(Flags...) {
  3669. # TODO: FIXME
  3670. ENABLE(UNUSED_MACRO)
  3671. }
  3672. ### @usage: NO_NEED_CHECK()
  3673. ###
  3674. ### Commits to the project marked with this macro will not be affected by higher-level NEED_CHECK macro.
  3675. macro NO_NEED_CHECK(Flags...) {
  3676. ENABLE(UNUSED_MACRO)
  3677. }
  3678. # tag:deprecated
  3679. ### @usage: NEED_REVIEW() # deprecated
  3680. ###
  3681. ### Mark the project as needing review.
  3682. ### Reviewers are listed in the macro OWNER. The use of this macro is disabled by default.
  3683. ### Details can be found here: https://clubs.at.yandex-team.ru/arcadia/6104
  3684. macro NEED_REVIEW(Flags...) {
  3685. # TODO: FIXME
  3686. ENABLE(UNUSED_MACRO)
  3687. }
  3688. ### @usage: VERSION(Args...)
  3689. ###
  3690. ### Specify version of a module. Currently unused by build system, only informative.
  3691. macro VERSION(Flags...) {
  3692. ENABLE(UNUSED_MACRO)
  3693. }
  3694. DATAWORK_SCHEEME_EXPORT_FLAGS=
  3695. when ($UNIX == "yes") {
  3696. SCHEEME2_CFLAGS= -E -x c++
  3697. }
  3698. when ($WIN32 == "yes") {
  3699. SCHEEME2_CFLAGS= /E /TP
  3700. }
  3701. SCHEEME2_STRUCT_INFO_FLAGS=-f "const static ui32 RecordSig" -u "RecordSig" --gcc44_no_typename --no_complex_overloaded_func_export
  3702. ### @usage: GEN_SCHEEME2(scheeme_name from_file dependent_files...)
  3703. ###
  3704. ### Generates a C++ description for structure(contains the field RecordSig) in the specified file (and connected).
  3705. ###
  3706. ### 1. ${scheeme_name}.inc - the name of the generated file.
  3707. ### 2. Use an environment variable - DATAWORK_SCHEEME_EXPORT_FLAGS that allows to specify flags to tools/structparser
  3708. ###
  3709. ### @example:
  3710. ###
  3711. ### SET(DATAWORK_SCHEEME_EXPORT_FLAGS --final_only -m "::")
  3712. ###
  3713. ### all options are passed to structparser (in this example --final_only - do not export heirs with public base that contains the required field,,- m "::" only from the root namespace)
  3714. ### sets in extra option
  3715. ###
  3716. ### @example:
  3717. ###
  3718. ### SET(EXTRACT_STRUCT_INFO_FLAGS -f \"const static ui32 RecordSig\"
  3719. ### -u \"RecordSig\" -n${scheeme_name}SchemeInfo ----gcc44_no_typename no_complex_overloaded_func_export
  3720. ### ${DATAWORK_SCHEEME_EXPORT_FLAGS})
  3721. ###
  3722. ### for compatibility with C++ compiler and the external environment.
  3723. ### See tools/structparser for more details.
  3724. macro GEN_SCHEEME2(ScheemeName, FromFile) {
  3725. .CMD=$CXX_COMPILER $C_FLAGS_PLATFORM -c ${tmp;stdout:FromFile.cph} $SCHEEME2_CFLAGS ${input:FromFile} ${pre=-I:_C__INCLUDE} $CXXFLAGS -Wno-error && ${tool:"tools/structparser"} -o ${output:ScheemeName.inc} -n N${ScheemeName}SchemeInfo $SCHEEME2_STRUCT_INFO_FLAGS $DATAWORK_SCHEEME_EXPORT_FLAGS ${tmp:FromFile.cph} ${output;stdout;noauto:ScheemeName.inc.log} ${kv;hide:"p SH"} ${kv;hide:"pc yellow"}
  3726. }
  3727. ### @usage: SYMLINK(from to)
  3728. ### Add symlink
  3729. macro SYMLINK(From, To) {
  3730. .CMD=$YMAKE_PYTHON ${input:"build/scripts/symlink.py"} ${input;dirallowed:From} ${output;noauto:To} ${kv;hide:"p LN"} ${kv;hide:"pc light-cyan"}
  3731. }
  3732. # tag:internal
  3733. ### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
  3734. ### Generate prefix " && target_sources PRIVATE " before $Args when GENERATE is specified in the list of actual arguments
  3735. macro _TARGET_SOURCES_FOR_HEADERS_IMPL(GENERATE?" && target_sources PRIVATE ":"", Args...) {
  3736. .SEM=$GENERATE ${output;ext=.h:Args} ${output;ext=.hh:Args} ${output;ext=.hpp:Args} ${output;ext=.inc:Args} ${output;ext=.i:Args}
  3737. }
  3738. # tag:internal
  3739. ### @usage: _TARGET_SOURCES_FOR_HEADERS(Args...) # internal
  3740. ### Generate prefix " && target_sources PRIVATE " before $Args if Args is not empty
  3741. macro _TARGET_SOURCES_FOR_HEADERS(Args...) {
  3742. .SEM=$_TARGET_SOURCES_FOR_HEADERS_IMPL(${pre=GENERATE :Args})
  3743. }
  3744. # tag:internal
  3745. ### @usage: _TARGET_SOURCES_FOR_HEADERS_IMPL([GENERATE] Args...) # internal
  3746. ### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args when GENERATE is specified in the list of actual arguments
  3747. macro _SET_ENV_FOR_CUSTOM_COMMAND_IMPL(GENERATE?" ${CMAKE_COMMAND} -E env ":"", Args...) {
  3748. .SEM=$GENERATE ${pre= :Args}
  3749. }
  3750. # tag:internal
  3751. ### @usage: _SET_ENV_FOR_CUSTOM_COMMAND(Args...) # internal
  3752. ### Generate prefix " ${CMAKE_COMMAND} -E env " before $Args if Args is not empty
  3753. macro _SET_ENV_FOR_CUSTOM_COMMAND(Args...) {
  3754. .SEM=$_SET_ENV_FOR_CUSTOM_COMMAND_IMPL(${pre=GENERATE :Args})
  3755. }
  3756. macro _FMT_INDUCED_DEPS(For, Deps...) {
  3757. .CMD=${induced_deps=$For;hide:Deps}
  3758. }
  3759. ### @usage: PREPARE_INDUCED_DEPS(VAR Type Files...)
  3760. ###
  3761. ### Format value for `INDUCED_DEPS` param in certain macros and assign to `VAR`
  3762. ### This tells that files of Type resulted from code generation macros (not neccessarily directly,
  3763. ### but in processing chain of generated files) should have extra dependencies from list of Files...
  3764. ###
  3765. ### Prominent example here is Cython: one can generate .pyx file that may depend on .pxd and have cimpot from
  3766. ### certain .h. The former is dependency for .pyx itself, while the latter is dependency for .pyx.cpp
  3767. ### resulted from Cython-processing of generated pyx. The code ganeration will look like:
  3768. ### ```
  3769. ### PREPARE_INDUCED_DEPS(PYX_DEPS pyx imported.pxd)
  3770. ### PREPARE_INDUCED_DEPS(CPP_DEPS cpp cdefed.h)
  3771. ### RUN_PYTHON3(generate_pyx.py genereted.pyx OUT generated.pyx INDUCED_DEPS $PYX_DEPS $CPP_DEPS)
  3772. ### ```
  3773. ###
  3774. ### The VAR will basically contain pair of `Type:[Files...]` in a form suitable for passing
  3775. ### as an element of array parameter. This is needed because language of ya.make doesn't support
  3776. ### Dict params right now and so it is impossible to directly pass something
  3777. ### like `{Type1:[Files2...], Type2:[Files2...]}`
  3778. ###
  3779. macro PREPARE_INDUCED_DEPS(VAR, For, Deps...) {
  3780. SET($VAR \$_FMT_INDUCED_DEPS($For $Deps))
  3781. }
  3782. ### @usage: RUN_PROGRAM(tool_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  3783. ###
  3784. ### Run a program from arcadia.
  3785. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  3786. ###
  3787. ### Parameters:
  3788. ### - tool_path - Path to the directory of the tool.
  3789. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  3790. ### - CWD dir - Absolute path of the working directory.
  3791. ### - ENV key=value... - Environment variables.
  3792. ### - TOOL tools... - Auxiliary tool directories.
  3793. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  3794. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  3795. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  3796. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  3797. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  3798. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  3799. ###
  3800. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  3801. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  3802. ### Note that Tool is always built for the host platform, so be careful to provide that tool can be built for all Arcadia major host platforms (Linux, MacOS and Windows).
  3803. macro RUN_PROGRAM(Tool, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], IN_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  3804. .CMD=${cwd:CWD} ${env:ENV} ${tool:Tool} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${input;hide:IN_DEPS} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PR"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  3805. .SEM=add_custom_command $_SET_ENV_FOR_CUSTOM_COMMAND($ENV) OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input;context=TEXT:IN_NOPARSE} ${tool:Tool} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND ${tool:Tool} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} $_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO)
  3806. }
  3807. # tag:lua-specific
  3808. ### @usage: RUN_LUA(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  3809. ###
  3810. ### Run a lua script.
  3811. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  3812. ###
  3813. ### Parameters:
  3814. ### - script_path - Path to the script.3
  3815. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  3816. ### - CWD dir - Absolute path of the working directory.
  3817. ### - ENV key=value... - Environment variables.
  3818. ### - TOOL tools... - Auxiliary tool directories.
  3819. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  3820. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  3821. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  3822. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  3823. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  3824. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  3825. ###
  3826. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  3827. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  3828. macro RUN_LUA(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  3829. .CMD=${cwd:CWD} ${env:ENV} $LUA_TOOL ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p LU"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  3830. }
  3831. # tag:python-specific
  3832. ### @usage: PYTHON(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  3833. ###
  3834. ### Run a python script with $(PYTHON)/python built from devtools/huge_python.
  3835. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  3836. ###
  3837. ### Parameters:
  3838. ### - script_path - Path to the script.
  3839. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  3840. ### - CWD dir - Absolute path of the working directory.
  3841. ### - ENV key=value... - Environment variables.
  3842. ### - TOOL tools... - Auxiliary tool directories.
  3843. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  3844. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  3845. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  3846. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  3847. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  3848. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  3849. ###
  3850. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  3851. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  3852. macro PYTHON(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  3853. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  3854. .SEM=find_package Python2 && add_custom_command $_SET_ENV_FOR_CUSTOM_COMMAND($ENV) OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input;context=TEXT:IN_NOPARSE} ${input:ScriptPath} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND Python2::Interpreter ${input:ScriptPath} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} $_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO)
  3855. }
  3856. # tag:python-specific
  3857. ### @usage: RUN_PYTHON3(script_path args... [CWD dir] [ENV key=value...] [TOOL tools...] [IN[_NOPARSE] inputs...] [OUT[_NOAUTO] outputs...] [STDOUT[_NOAUTO] output] [OUTPUT_INCLUDES output_includes...] [INDUCED_DEPS $VARs...])
  3858. ###
  3859. ### Run a python script with prebuilt python3 interpretor built from devtools/huge_python3.
  3860. ### These macros are similar: RUN_PROGRAM, RUN_LUA, PYTHON.
  3861. ###
  3862. ### Parameters:
  3863. ### - script_path - Path to the script.
  3864. ### - args... - Program arguments. Relative paths listed in TOOL, IN, OUT, STDOUT become absolute.
  3865. ### - CWD dir - Absolute path of the working directory.
  3866. ### - ENV key=value... - Environment variables.
  3867. ### - TOOL tools... - Auxiliary tool directories.
  3868. ### - IN[_NOPARSE] inputs... - Input files. NOPARSE inputs are treated as textual and not parsed for dependencies regardless of file extensions.
  3869. ### - OUT[_NOAUTO] outputs... - Output files. NOAUTO outputs are not automatically added to the build process.
  3870. ### - STDOUT[_NOAUTO] output - Redirect the standard output to the output file.
  3871. ### - OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  3872. ### - INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  3873. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  3874. ###
  3875. ### For absolute paths use ${ARCADIA_ROOT} and ${ARCADIA_BUILD_ROOT}, or
  3876. ### ${CURDIR} and ${BINDIR} which are expanded where the outputs are used.
  3877. macro RUN_PYTHON3(ScriptPath, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  3878. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON3 ${input:ScriptPath} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PY"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  3879. .SEM=find_package Python3 && add_custom_command $_SET_ENV_FOR_CUSTOM_COMMAND($ENV) OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} ${output:STDOUT} ${output;noauto:STDOUT_NOAUTO} DEPENDS ${input:IN} ${input;context=TEXT:IN_NOPARSE} ${input:ScriptPath} ${tool:TOOL} ${pre=WORKING_DIRECTORY :CWD} COMMAND Python3::Interpreter ${input:ScriptPath} $Args ${pre=> :STDOUT} ${pre=> :STDOUT_NOAUTO} $_TARGET_SOURCES_FOR_HEADERS($OUT $OUT_NOAUTO $STDOUT $STDOUT_NOAUTO)
  3880. }
  3881. # tag:java-specific
  3882. macro _RUN_JAVA(IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], TOOL[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], HIDE_OUTPUT?"stderr2stdout":"stdout2stderr", Args...) {
  3883. PEERDIR(build/platform/java/jdk $JDK_RESOURCE_PEERDIR)
  3884. .CMD=${cwd:CWD} ${env:ENV} $YMAKE_PYTHON ${input;pre=build/scripts/:HIDE_OUTPUT.py} $JDK_RESOURCE/bin/java $Args ${tool;hide:TOOL} ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p JV"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  3885. }
  3886. ### @usage: FROM_SANDBOX([FILE] resource_id [AUTOUPDATED script] [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  3887. ###
  3888. ### Download the resource from the Sandbox, unpack (if not explicitly specified word FILE) and add OUT files to the build. EXECUTABLE makes them executable.
  3889. ### You may specify extra dependencies that output files bring using OUTPUT_INCLUDES or INDUCED_DEPS. The change of these may e.g. lead to recompilation of .cpp files extracted from resource.
  3890. ### If there is no default processing for OUT files or you need process them specially use OUT_NOAUTO instead of OUT.
  3891. ###
  3892. ### It is disallowed to specify directory as OUT/OUT_NOAUTO since all outputs of commands shall be known to build system.
  3893. ###
  3894. ### RENAME renames files to the corresponding OUT and OUT_NOAUTO outputs:
  3895. ### FROM_SANDBOX(resource_id RENAME in_file1 in_file2 OUT out_file1 out_file2 out_file3)
  3896. ### FROM_SANDBOX(resource_id RENAME in_file1 OUT out_file1 RENAME in_file2 OUT out_file2)
  3897. ### FROM_SANDBOX(FILE resource_id RENAME resource_file OUT out_name)
  3898. ###
  3899. ### RENAME RESOURCE allows to rename the resource without specifying its file name.
  3900. ###
  3901. ### OUTPUT_INCLUDES output_includes... - Includes of the output files that are needed to build them.
  3902. ### INDUCED_DEPS $VARs... - Dependencies for generated files. Unlike `OUTPUT_INCLUDES` these may target files further in processing chain.
  3903. ### In order to do so VAR should be filled by PREPARE_INDUCED_DEPS macro, stating target files (by type) and set of dependencies
  3904. ###
  3905. ### If AUTOUPDATED is specified than macro will be regularly updated according to autoupdate script. The dedicated Sandbox task scans the arcadia and
  3906. ### changes resource_ids in such macros if newer resource of specified type is available. Note that the task seeks AUTOUPDATED in specific position,
  3907. ### so you shall place it immediately after resource_id.
  3908. macro FROM_SANDBOX(Id, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], FILE?"--copy-to-dir":"--untar-to", AUTOUPDATED="", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", SBR="sbr:", EXTERNAL_FILE="") {
  3909. .CMD=${hide:SANDBOX_FAKEID} ${cwd:BINDIR} ${resource;pre=$SBR:Id} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_sandbox.py"} --resource-file $(RESOURCE_ROOT)/sbr/$Id/resource --resource-id $Id $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p SB"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  3910. ADD_CHECK(check.resource $Id)
  3911. ADD_CHECK(check.external $EXTERNAL_FILE)
  3912. }
  3913. ### @usage: FROM_MDS([FILE] key [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  3914. ###
  3915. ### Download resource from MDS with the specified key and process like [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  3916. macro FROM_MDS(Key, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], FILE?"--copy-to-dir":"--untar-to", PREFIX=".", RENAME[], EXECUTABLE?"--executable":"", EXTERNAL_FILE="") {
  3917. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_mds.py"} --key $Key $FILE $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${requirements;hide:"network:full"} ${kv;hide:"p MD"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  3918. ADD_CHECK(check.mds $Key)
  3919. ADD_CHECK(check.external $EXTERNAL_FILE)
  3920. }
  3921. ### @usage LARGE_FILES([AUTOUPDATED] Files...)
  3922. ###
  3923. ### Use large file ether from working copy or from remote storage via placeholder <File>.external
  3924. ### If <File> is present locally (and not a symlink!) it will be copied to build directory.
  3925. ### Otherwise macro will try to locate <File>.external, parse it retrieve ot during build phase.
  3926. macro LARGE_FILES(AUTOUPDATED?, Files...) {
  3927. # This is needed to correctly switch between remote and local modes
  3928. _GLOB($LF $Files)
  3929. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${suf=.external:Files})
  3930. }
  3931. ### @usage: FROM_ARCHIVE(Src [RENAME <resource files>] OUT_[NOAUTO] <output files> [EXECUTABLE] [OUTPUT_INCLUDES <include files>] [INDUCED_DEPS $VARs...])
  3932. ###
  3933. ### Process file archive as [FROM_SANDBOX()](#macro_FROM_SANDBOX).
  3934. macro FROM_ARCHIVE(Src, OUT{output}[], OUT_NOAUTO{output}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], PREFIX=".", RENAME[], EXECUTABLE?"--executable":"") {
  3935. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/fetch_from_archive.py"} "--archive" ${input:Src} "--file-name" ${suf=-:Src} "--untar-to" $PREFIX ${pre=--rename :RENAME} $EXECUTABLE -- $OUT $OUT_NOAUTO ${input;hide:"build/scripts/fetch_from.py"} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${kv;hide:"p FA"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  3936. }
  3937. when ($MSVC == "yes") {
  3938. C_AS_CXX_FLAGS=/TP /std:c++17
  3939. }
  3940. otherwise {
  3941. C_AS_CXX_FLAGS=-x c++ -std=c++17
  3942. }
  3943. # tag:cpp-specific
  3944. ### @usage: COMPILE_C_AS_CXX()
  3945. ###
  3946. ### Compile .c files as .cpp ones within a module.
  3947. macro COMPILE_C_AS_CXX() {
  3948. SET(EXTRA_C_FLAGS $C_AS_CXX_FLAGS)
  3949. }
  3950. ### @usage: NO_DEBUG_INFO()
  3951. ###
  3952. ### Compile files without debug info collection.
  3953. macro NO_DEBUG_INFO() {
  3954. SET(NO_DEBUGINFO yes)
  3955. }
  3956. ### @usage: CTEMPLATE_VARNAMES(File)
  3957. ###
  3958. ### Generate File.varnames.h using contrib/libs/ctemplate/make_tpl_varnames_h
  3959. ###
  3960. ### Documentation: https://a.yandex-team.ru/arc/trunk/arcadia/contrib/libs/ctemplate/README.md
  3961. macro CTEMPLATE_VARNAMES(File) {
  3962. .CMD=${tool:"contrib/libs/ctemplate/make_tpl_varnames_h"} -f ${output;addincl;nopath;noallext:File.varnames.h} ${input:File}
  3963. }
  3964. LLVM_OPTS=
  3965. CLANG_BC_ROOT=${CLANG11_RESOURCE_GLOBAL}
  3966. macro USE_LLVM_BC12() {
  3967. SET(CLANG_BC_ROOT ${CLANG12_RESOURCE_GLOBAL})
  3968. }
  3969. macro USE_LLVM_BC14() {
  3970. SET(CLANG_BC_ROOT ${CLANG14_RESOURCE_GLOBAL})
  3971. }
  3972. macro USE_LLVM_BC16() {
  3973. SET(CLANG_BC_ROOT ${CLANG16_RESOURCE_GLOBAL})
  3974. }
  3975. CLANG_DEFAULT_ROOT=${CLANG_RESOURCE_GLOBAL}
  3976. CLANG_C_COMPILER_BIN=${CLANG_RESOURCE_GLOBAL}/bin/clang
  3977. CLANG_CPP_COMPILER_BIN=${CLANG_RESOURCE_GLOBAL}/bin/clang++
  3978. CLANG_EMIT_EXTRA_OPTS=
  3979. when ($OS_WINDOWS == "yes") {
  3980. # we can't use c++latest for clang14 now
  3981. # so we set c++20 for it
  3982. # for clang11 (actual clang for CLANG_EMIT_AST_CXX and LLVM_COMPILE_* macroses) /std:c++20 provokes "unused-command-line-argument" error
  3983. # !do not forget to change this flag when updating build/platform/clang
  3984. CLANG_EMIT_EXTRA_OPTS+=/std:c++latest
  3985. }
  3986. when ($OS_ANDROID == "yes") {
  3987. # We use clang shipped with android-ndk which has different layout
  3988. CLANG_DEFAULT_ROOT=$CLANG_ANDROID_RESOURCE_GLOBAL
  3989. when ($HOST_OS_DARWIN) {
  3990. CLANG_C_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
  3991. CLANG_CPP_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
  3992. }
  3993. otherwise {
  3994. CLANG_C_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
  3995. CLANG_CPP_COMPILER_BIN=${CLANG_ANDROID_RESOURCE_GLOBAL}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++
  3996. }
  3997. }
  3998. ### @usage: CLANG_EMIT_AST_CXX(Input Output Opts...)
  3999. ###
  4000. ### Emit Clang AST from .cpp file. CXXFLAGS and LLVM_OPTS are passed in, while CFLAGS and C_FLAGS_PLATFORM are not.
  4001. ### Note: Output name is used as is, no extension added.
  4002. macro CLANG_EMIT_AST_CXX(Input, Output, Opts...) {
  4003. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_CPP_COMPILER_BIN} ${pre=-I:_C__INCLUDE} $CXXFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS -emit-ast -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p ST"} ${kv;hide:"pc light-green"}
  4004. PEERDIR(build/platform/clang)
  4005. }
  4006. ### @usage: LLVM_COMPILE_CXX(Input Output Opts...)
  4007. ###
  4008. ### Emit LLVM bytecode from .cpp file. BC_CXXFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  4009. ### Note: Output name is used as is, no extension added.
  4010. macro LLVM_COMPILE_CXX(Input, Output, Opts...) {
  4011. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_BC_ROOT}/bin/clang++ ${pre=-I:_C__INCLUDE} $BC_CXXFLAGS $C_FLAGS_PLATFORM -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm -c ${input:Input} -o ${output;noauto:Output} $Opts $CLANG_EMIT_EXTRA_OPTS ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  4012. .SEM=llvm_compile_cxx ${input:Input} ${output;noauto:Output} ${"${CLANGPLUSPLUS}"} -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm ${Opts}
  4013. PEERDIR(build/platform/clang)
  4014. }
  4015. ### @usage: LLVM_COMPILE_C(Input Output Opts...)
  4016. ###
  4017. ### Emit LLVM bytecode from .c file. BC_CFLAGS, LLVM_OPTS and C_FLAGS_PLATFORM are passed in, while CFLAGS are not.
  4018. ### Note: Output name is used as is, no extension added.
  4019. macro LLVM_COMPILE_C(Input, Output, Opts...) {
  4020. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_BC_ROOT}/bin/clang ${pre=-I:_C__INCLUDE} $BC_CFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm -c ${input:Input} -o ${output;noauto:Output} $Opts $CLANG_EMIT_EXTRA_OPTS ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  4021. .SEM=llvm_compile_c ${input:Input} ${output;noauto:Output} ${"${CLANGC}"} -Wno-unknown-warning-option $LLVM_OPTS ${NO_LTO_CFLAGS} -emit-llvm ${Opts}
  4022. PEERDIR(build/platform/clang)
  4023. }
  4024. ### @usage: BPF(Input Output Opts...)
  4025. ###
  4026. ### Emit eBPF bytecode from .c file.
  4027. ### Note: Output name is used as is, no extension added.
  4028. macro BPF(Input, Output, Opts...) {
  4029. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_C_COMPILER_BIN} ${pre=-I:_C__INCLUDE} $C_FLAGS_PLATFORM -target bpf -c ${input:Input} -o ${output;noauto:Output} $Opts $CLANG_EMIT_EXTRA_OPTS ${kv;hide:"p BP"} ${kv;hide:"pc light-green"}
  4030. PEERDIR(build/platform/clang)
  4031. }
  4032. LD_BINARY_NAME=ld
  4033. when($OS_LINUX) {
  4034. LD_BINARY_NAME=ld.lld
  4035. }
  4036. ### @usage: BPF_STATIC(Input Output Opts...)
  4037. ###
  4038. ### Emit eBPF bytecode from .c file.
  4039. ### Note: Output name is used as is, no extension added.
  4040. macro BPF_STATIC(Input, Output, Opts...) {
  4041. .CMD=$YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_C_COMPILER_BIN} ${pre=-I:_C__INCLUDE} $C_FLAGS_PLATFORM -target bpf -c ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p BP"} ${kv;hide:"pc light-green"} && ${cwd:BINDIR} $LLD_ROOT_RESOURCE_GLOBAL/$LD_BINARY_NAME -r -b binary -m elf_x86_64 -o ${output;noauto;suf=.bpf.o:Input} ${noauto;nopath:Output}
  4042. PEERDIR(build/platform/clang build/platform/lld)
  4043. }
  4044. ### @usage: LLVM_COMPILE_LL(Input Output Opts...)
  4045. ###
  4046. ### Compile LLVM bytecode to object representation.
  4047. ### Note: Output name is used as is, no extension added.
  4048. macro LLVM_COMPILE_LL(Input, Output, Opts...) {
  4049. .CMD=${CLANG_BC_ROOT}/bin/llvm-as ${input:Input} -o ${output;noauto:Output} ${kv;hide:"p BC"} ${kv;hide:"pc light-green"}
  4050. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Input} COMMAND ${LLVMAS} ${input:Input} -o ${output;noauto:Output}
  4051. PEERDIR(build/platform/clang)
  4052. }
  4053. ### @usage: LLVM_LINK(Output Inputs...)
  4054. ###
  4055. ### Call llvm-link on set of Inputs to produce Output.
  4056. ### Note: Unlike many other macros output argument goes first. Output name is used as is, no extension added.
  4057. macro LLVM_LINK(Output, Inputs...) {
  4058. .CMD=${CLANG_BC_ROOT}/bin/llvm-link ${input:Inputs} -o ${output;noauto:Output} ${kv;hide:"p LD"} ${kv;hide:"pc light-red"}
  4059. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Inputs} COMMAND ${LLVMLINK} ${input:Inputs} -o ${output;noauto:Output}
  4060. PEERDIR(build/platform/clang)
  4061. }
  4062. ### @usage: LLVM_OPT(Input Output Opts...)
  4063. ###
  4064. ### Call llvm-opt with set of Opts on Input to produce Output.
  4065. ### Note: Output name is used as is, no extension added.
  4066. macro LLVM_OPT(Input, Output, Opts...) {
  4067. .CMD=$YMAKE_PYTHON ${input:"build/scripts/llvm_opt_wrapper.py"} ${CLANG_BC_ROOT}/bin/opt ${input:Input} -o ${output;noauto:Output} $Opts ${kv;hide:"p OP"} ${kv;hide:"pc yellow"}
  4068. .SEM=add_custom_command OUTPUT ${output;noauto:Output} DEPENDS ${input:Input} COMMAND ${LLVMOPT} ${input:Input} -o ${output;noauto:Output} $Opts
  4069. PEERDIR(build/platform/clang)
  4070. }
  4071. ### @usage: LLVM_LLC(Src Opts...)
  4072. ###
  4073. ### Call llvm-llc with set of Opts on Src to produce object file.
  4074. ###
  4075. ### Note: Output name is calculated as concatenation of Src name and platform specific object file extension.
  4076. macro LLVM_LLC(Src, Opts...) {
  4077. .CMD=${tool:"contrib/libs/llvm14/tools/llc"} ${input:Src} --filetype obj -o ${output;suf=$OBJECT_SUF;noauto:Src} $Opts ${kv;hide:"p LC"} ${kv;hide:"pc yellow"}
  4078. .SEM=add_custom_command OUTPUT ${output;suf=$OBJECT_SUF;noauto:Src} DEPENDS ${input:Src} COMMAND ${LLVMLLC} --filetype obj ${input:Src} -o ${output;suf=$OBJECT_SUF;noauto:Src} $Opts
  4079. PEERDIR(build/platform/clang)
  4080. }
  4081. when ($NO_DEBUGINFO == "yes") {
  4082. DEBUG_INFO_FLAGS=
  4083. }
  4084. when ($CLANG && $DEBUGINFO_LINES_ONLY == "yes" && $NO_DEBUGINFO != "yes") {
  4085. DEBUG_INFO_FLAGS=-gline-tables-only
  4086. }
  4087. # TODO: configurable tar and touch
  4088. PACK_TGZ=${cwd:ARCADIA_BUILD_ROOT} tar -czf ${rootrel:OUTPUT} ${rootrel:INPUT} ${kv;hide:"p AR"} ${kv;hide:"pc light-red"}
  4089. # tag:internal
  4090. ### @usage TOUCH(Outputs...) # internal
  4091. ### Just introduce outputs
  4092. macro TOUCH(Outputs...) {
  4093. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output:Outputs}
  4094. }
  4095. TOUCH_UNIT=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"p UN"} ${kv;hide:"pc light-cyan"} $TARGET
  4096. FAKE_PACKAGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${kv;hide:"pc light-red"} $TARGET
  4097. COPY_PACKAGE_CMD=$YMAKE_PYTHON ${input:"build/scripts/copy_to_dir.py"} --dest-dir $BINDIR --build-root $ARCADIA_BUILD_ROOT $PACKED_PACKAGE_ARGS $SRCS_GLOBAL $PEERS_LATE_OUTS ${skip_by_ext=.pkg.fake:PEERS} ${hide;late_out:AUTO_INPUT} ${hide;late_out;to_namespace=$BINDIR/:SRCS_GLOBAL} ${hide;late_out;to_namespace=$BINDIR/:PEERS_LATE_OUTS} ${hide;late_out;skip_by_ext=.pkg.fake;to_namespace=$BINDIR/:PEERS} ${kv;hide:"package PACKAGE"}
  4098. TOUCH_PACKAGE=$FAKE_PACKAGE_CMD $VCS_INFO_DISABLE_CACHE__NO_UID__ && $COPY_PACKAGE_CMD
  4099. _P_PK=${kv;hide:"p PK"}
  4100. TOUCH_PACKAGE_MF=$GENERATE_MF && $TOUCH_PACKAGE $_P_PK && $ADD_VCS_INFO_FILE_CMD
  4101. # Note: we don't use touch.py in the command below to avoid introduction of undesired input
  4102. UNION_CMD=$YMAKE_PYTHON -c open(\'$TARGET\',\'w\').close() ${kv;hide:"p UN"} ${kv;hide:"package UNION"} ${kv;hide:"pc light-cyan"} $UNION_OUTS $VCS_INFO_DISABLE_CACHE__NO_UID__
  4103. UNION_CMD_MF=$UNION_CMD && $GENERATE_MF
  4104. macro _EXPAND_INS_OUTS(FILES{input}[]) {
  4105. .CMD=${input;hide:FILES} ${late_out;hide:INPUT}
  4106. }
  4107. _UNION_EXPLICIT_OUTPUTS=
  4108. ### @usage: EXPLICIT_OUTPUTS(Files...)
  4109. ###
  4110. ### Let UNION has only explicitly specified outputs listed in this macro
  4111. ### The list of files shall contain results of commands in this UNION.
  4112. ### Only these files will be outputs of the UNION. This allows to eliminate
  4113. ### intermediate files being result of the UNION
  4114. macro EXPLICIT_OUTPUTS(Files...) {
  4115. SET_APPEND(_UNION_EXPLICIT_OUTPUTS ${Files})
  4116. }
  4117. NO_CHECK_IMPORTS_FOR_VALUE=None
  4118. ### @usage: NO_CHECK_IMPORTS([patterns])
  4119. ###
  4120. ### Do not run checks on imports of Python modules.
  4121. ### Optional parameter mask patterns describes the names of the modules that do not need to check.
  4122. macro NO_CHECK_IMPORTS(Masks...) {
  4123. SET(NO_CHECK_IMPORTS_FOR_VALUE $Masks)
  4124. }
  4125. # tag:yasm-specific
  4126. _YASM_FMT_VALUE=
  4127. _YASM_PLATFORM_FLAGS_VALUE=
  4128. _YASM_PREDEFINED_FLAGS_VALUE=
  4129. when ($OS_DARWIN || $OS_IOS) {
  4130. _YASM_FMT_VALUE=macho
  4131. _YASM_PLATFORM_FLAGS_VALUE=-D DARWIN -D UNIX
  4132. }
  4133. elsewhen ($OS_WINDOWS && $ARCH_X86_64) {
  4134. _YASM_FMT_VALUE=win
  4135. _YASM_PLATFORM_FLAGS_VALUE=-D WIN64
  4136. }
  4137. elsewhen ($OS_WINDOWS && $ARCH_I386) {
  4138. _YASM_FMT_VALUE=win
  4139. _YASM_PLATFORM_FLAGS_VALUE=-D WIN32
  4140. }
  4141. otherwise {
  4142. _YASM_FMT_VALUE=elf
  4143. _YASM_PLATFORM_FLAGS_VALUE=-D UNIX
  4144. _YASM_PREDEFINED_FLAGS_VALUE=-g dwarf2
  4145. }
  4146. when ($ASM_PREFIX) {
  4147. ASM_PREFIX_VALUE=--prefix=$ASM_PREFIX
  4148. }
  4149. otherwise {
  4150. ASM_PREFIX_VALUE=
  4151. }
  4152. # tag:yasm-specific
  4153. YASM_FLAGS=
  4154. YASM_PREINCLUDES_VALUE=
  4155. # tag:yasm-specific
  4156. macro _SRC_yasm_helper(SRC, PREINCLUDES[], SRCFLAGS...) {
  4157. .CMD=${tool:"contrib/tools/yasm"} -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} $_YASM_PLATFORM_FLAGS_VALUE $YASM_DEBUG_INFO $YASM_DEBUG_INFO_DISABLE_CACHE__NO_UID__ -D ${pre=_;suf=_:HARDWARE_TYPE} -D_YASM_ $ASM_PREFIX_VALUE $_YASM_PREDEFINED_FLAGS_VALUE $YASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS -o ${output;noext;suf=${OBJECT_SUF}:SRC} ${pre=-P :PREINCLUDES} ${input;hide:PREINCLUDES} ${SRC} ${kv;hide:"p AS"} ${kv;hide:"pc light-green"}
  4158. }
  4159. # tag:yasm-specific
  4160. macro _SRC_yasm(SRC, PREINCLUDES[], SRCFLAGS...) {
  4161. .CMD=$_SRC_yasm_helper(${input:SRC}, $SRCFLAGS, PREINCLUDES $PREINCLUDES)
  4162. }
  4163. # tag:nasm-specific
  4164. NASM_FLAGS=
  4165. # tag:nasm-specific
  4166. macro _SRC_nasm_helper(SRC, SRCFLAGS...) {
  4167. .CMD=${NASM_RESOURCE_GLOBAL}/bin/nasm -f ${_YASM_FMT_VALUE}${HARDWARE_ARCH} -D ${pre=_;suf=_:HARDWARE_TYPE} $NASM_FLAGS ${pre=-I :_ASM__INCLUDE} $SRCFLAGS -o ${output;noext;suf=${OBJECT_SUF}:SRC} ${SRC}
  4168. }
  4169. # tag:nasm-specific
  4170. macro _SRC_nasm(SRC, PREINCLUDES[], SRCFLAGS...) {
  4171. .CMD=$_SRC_nasm_helper(${input:SRC}, $SRCFLAGS)
  4172. }
  4173. # tag:src-processing
  4174. when ($USE_NASM_ASSEMBLER == "yes") {
  4175. _SRC_ASM_CMDLINE=$_SRC_nasm($SRC $SRCFLAGS)
  4176. }
  4177. otherwise {
  4178. _SRC_ASM_CMDLINE=$_SRC_yasm($SRC $SRCFLAGS)
  4179. }
  4180. # tag:src-processing
  4181. macro _SRC_ASM(SRC, SRCFLAGS...) {
  4182. .CMD=$_SRC_ASM_CMDLINE
  4183. }
  4184. ### @usage: ASM_PREINCLUDE(AsmFiles...)
  4185. ###
  4186. ### Supply additional .asm files to all assembler calls within a module
  4187. macro ASM_PREINCLUDE(PREINCLUDES...) {
  4188. SET_APPEND(YASM_PREINCLUDES_VALUE $PREINCLUDES)
  4189. }
  4190. ### @usage: RUN_ANTLR(Args...)
  4191. ###
  4192. ### Macro to invoke ANTLR3 generator (general case)
  4193. macro RUN_ANTLR(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
  4194. _RUN_JAVA(-jar ${input:"contrib/java/antlr/antlr3/antlr.jar"} $Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD})
  4195. .SEM=run_antlr OUTPUT ${output:OUT} ${output;noauto:OUT_NOAUTO} DEPENDS ${input:IN} ${pre=WORKING_DIRECTORY :CWD} ANTLER_ARGS $Args
  4196. }
  4197. ### @usage: RUN_ANTLR4(Args...)
  4198. ###
  4199. ### Macro to invoke ANTLR4 generator (general case)
  4200. macro RUN_ANTLR4(IN[], IN_NOPARSE[], OUT[], OUT_NOAUTO[], OUTPUT_INCLUDES[], INDUCED_DEPS[], CWD="", Args...) {
  4201. _RUN_JAVA(-jar ${input:"contrib/java/antlr/antlr4/antlr.jar"} $Args IN $IN IN_NOPARSE $IN_NOPARSE OUT $OUT OUT_NOAUTO $OUT_NOAUTO OUTPUT_INCLUDES $OUTPUT_INCLUDES INDUCED_DEPS $INDUCED_DEPS ${pre=CWD :CWD})
  4202. }
  4203. _ANTLR4_LISTENER_GRAMMAR=-listener
  4204. _ANTLR4_LISTENER_PARSER=-listener
  4205. _ANTLR4_LISTENER__ANTLR4_EMPTY=-no-listener
  4206. _ANTLR4_VISITOR_GRAMMAR=-visitor
  4207. _ANTLR4_VISITOR_PARSER=-visitor
  4208. _ANTLR4_VISITOR__ANTLR4_EMPTY=-no-visitor
  4209. ### @usage: RUN_ANTLR4_CPP_SPLIT(LEXER, PARSER, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  4210. ###
  4211. ### Macro to invoke ANTLR4 generator for separate lexer and parser grammars (Cpp)
  4212. macro RUN_ANTLR4_CPP_SPLIT(LEXER, PARSER, OUTPUT_INCLUDES[], LISTENER?"PARSER":"_ANTLR4_EMPTY", VISITOR?"PARSER":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  4213. RUN_ANTLR4(${LEXER} ${PARSER} -Dlanguage=Cpp -o ${BINDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${LEXER} ${PARSER} OUT ${noext;suf=.cpp:LEXER} ${noext;suf=.h:LEXER} ${noext;suf=.cpp:PARSER} ${noext;suf=.h:PARSER} ${noext;suf=Listener.h:$LISTENER} ${noext;suf=BaseListener.h:$LISTENER} ${noext;suf=Visitor.h:$VISITOR} ${noext;suf=BaseVisitor.h:$VISITOR} OUTPUT_INCLUDES ${ARCADIA_ROOT}/contrib/libs/antlr4_cpp_runtime/src/antlr4-runtime.h ${OUTPUT_INCLUDES})
  4214. PEERDIR(contrib/libs/antlr4_cpp_runtime)
  4215. }
  4216. ### @usage: RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES, LISTENER, VISITOR, Args...)
  4217. ###
  4218. ### Macro to invoke ANTLR4 generator for combined lexer+parser grammars (Cpp)
  4219. macro RUN_ANTLR4_CPP(GRAMMAR, OUTPUT_INCLUDES[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  4220. RUN_ANTLR4(${GRAMMAR} -Dlanguage=Cpp -o ${BINDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${GRAMMAR} OUT ${noext;suf=Lexer.cpp:GRAMMAR} ${noext;suf=Lexer.h:GRAMMAR} ${noext;suf=Parser.cpp:GRAMMAR} ${noext;suf=Parser.h:GRAMMAR} ${noext;suf=Listener.h:$LISTENER} ${noext;suf=BaseListener.h:$LISTENER} ${noext;suf=Visitor.h:$VISITOR} ${noext;suf=BaseVisitor.h:$VISITOR} OUTPUT_INCLUDES ${ARCADIA_ROOT}/contrib/libs/antlr4_cpp_runtime/src/antlr4-runtime.h ${OUTPUT_INCLUDES})
  4221. PEERDIR(contrib/libs/antlr4_cpp_runtime)
  4222. }
  4223. ### @usage: RUN_ANTLR4_GO(GRAMMAR, DEPS <extra_go_deps>, LISTENER, VISITOR, Args...)
  4224. ###
  4225. ### Macro to invoke ANTLR4 generator (Go)
  4226. macro RUN_ANTLR4_GO(GRAMMAR, DEPS[], LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", _ANTLR4_EMPTY="", Args...) {
  4227. RUN_ANTLR4(${GRAMMAR} -Dlanguage=Go -o ${BINDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${GRAMMAR} OUT ${noext;tolower;suf=_lexer.go:GRAMMAR} ${noext;tolower;suf=_parser.go:GRAMMAR} ${noext;tolower;suf=_listener.go:$LISTENER} ${noext;tolower;suf=_base_listener.go:$LISTENER} ${noext;tolower;suf=_visitor.go:$VISITOR} ${noext;tolower;suf=_base_visitor.go:$VISITOR})
  4228. PEERDIR(${GOSTD}/fmt ${GOSTD}/reflect ${GOSTD}/strconv ${GOSTD}/sync ${GOSTD}/unicode vendor/github.com/antlr/antlr4/runtime/Go/antlr/v4 $DEPS)
  4229. }
  4230. ### @usage: RUN_ANTLR4_PYTHON(Grammar [LISTENER] [VISITOR] [SUBDIR] [EXTRA_OUTS Outs...] Args...)
  4231. ###
  4232. ### `LISTENER` - emit grammar listener
  4233. ### `VISITOR` - emit grammar visitor
  4234. ### `SUBDIR` - place generated files to specified subdirectory of BINDIR
  4235. ### `EXTRA_OUTS` - list extra outputs produced by Antlr (e.g. .interp and .token files) if they are needed. If `SUBDIR` is specied it will affect these as well. Use file names only.
  4236. ###
  4237. ### Macro to invoke ANTLR4 generator (Python). The Python3 will be used for PY3_LIBRARY/PY3_PROGRAM/PY3TEST, Python2 will be used in all other cases.
  4238. macro RUN_ANTLR4_PYTHON(GRAMMAR, LISTENER?"GRAMMAR":"_ANTLR4_EMPTY", VISITOR?"GRAMMAR":"_ANTLR4_EMPTY", SUBDIR=".", EXTRA_OUTS[], _ANTLR4_EMPTY="", Args...) {
  4239. RUN_ANTLR4(${GRAMMAR} -Dlanguage=$ANTLR_PYTHON -o ${BINDIR}/${SUBDIR} ${_ANTLR4_VISITOR_$VISITOR} ${_ANTLR4_LISTENER_$LISTENER} ${Args} CWD ${BINDIR} IN ${GRAMMAR} OUT_NOAUTO ${nopath;noext;pre=${SUBDIR}/;suf=Lexer.py:GRAMMAR} ${nopath;noext;pre=${SUBDIR}/;suf=Parser.py:GRAMMAR} ${nopath;noext;pre=${SUBDIR}/;suf=Listener.py:$LISTENER} ${nopath;noext;pre=${SUBDIR}/;suf=Visitor.py:$VISITOR} ${pre=${SUBDIR}/:EXTRA_OUTS})
  4240. PEERDIR(contrib/python/antlr4)
  4241. }
  4242. # tag:cpp-specific
  4243. macro CPP_ADDINCL(Dirs...) {
  4244. ADDINCL($Dirs)
  4245. }
  4246. # tag:internal
  4247. _WHOLE_ARCHIVE_PEERS_VALUE=
  4248. ### @usage: WHOLE_ARCHIVE(dirnames...) # internal
  4249. macro WHOLE_ARCHIVE(PEERS...) {
  4250. SET_APPEND(_WHOLE_ARCHIVE_PEERS_VALUE ${PEERS})
  4251. REQUIRES(${PEERS})
  4252. }
  4253. ANDROID_SDK_ROOT=${ANDROID_SDK_RESOURCE_GLOBAL}/android_sdk
  4254. macro TASKLET() {
  4255. PEERDIR(tasklet/api)
  4256. # CPP
  4257. CPP_PROTO_PLUGIN(tasklet_cpp tasklet/v1/gen/cpp .tasklet.h)
  4258. # Python
  4259. PY_PROTO_PLUGIN2(tasklet_py _tasklet.py _sbtask.py tasklet/v1/gen/python DEPS tasklet/v1/domain/sandbox tasklet/v1/runtime sandbox/sdk2)
  4260. }
  4261. TASKLET_REG_INCLUDES= \
  4262. ${output_include;hide:"tasklet/v1/runtime/lib/cpp_wrapper.h"} \
  4263. ${output_include;hide:"tasklet/v1/runtime/lib/go_wrapper.h"} \
  4264. ${output_include;hide:"tasklet/v1/runtime/lib/py_wrapper.h"} \
  4265. ${output_include;hide:"tasklet/v1/runtime/lib/js_wrapper.h"} \
  4266. ${output_include;hide:"tasklet/v1/runtime/lib/registry.h"}
  4267. macro TASKLET_REG(Name, Lang, Impl, Includes...) {
  4268. PEERDIR(tasklet/v1/domain sandbox/bin sandbox/taskbox/worker)
  4269. when($Lang == "js") {
  4270. # JS runtime links the Node.js from contrib as a library, which is a bit heavy,
  4271. # so we do it, only if any JS tasklets are linked into the target
  4272. PEERDIR+=tasklet/v1/runtime/js
  4273. }
  4274. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_tasklet_reg.py"} $Name -l $Lang -i $Impl ${output;noauto:Name.task.cpp} $Includes ${output_include;hide:Includes} $TASKLET_REG_INCLUDES ${kv;hide:"p TT"} ${kv;hide:"pc yellow"}
  4275. SRCS(GLOBAL $Name.task.cpp)
  4276. }
  4277. # TEMPORARY METHOD FOR EXTENDED REGISTRY SETUP
  4278. # NOT COMPLETE
  4279. macro TASKLET_REG_EXT(Name, Lang, Impl, Wrapper, Includes...) {
  4280. PEERDIR(tasklet/v1/domain sandbox/bin sandbox/taskbox/worker)
  4281. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_tasklet_reg.py"} $Name -l $Lang -i $Impl -w $Wrapper ${output;noauto:Name.task.cpp} $Includes ${output_include;hide:Includes} $TASKLET_REG_INCLUDES ${kv;hide:"p TT"} ${kv;hide:"pc yellow"}
  4282. SRCS(GLOBAL $Name.task.cpp)
  4283. }
  4284. # tag:cpp-specific
  4285. _CPP_PROTO_MODULE_PREFIX=
  4286. _CPP_PROTO_MODULE_SUFFIX=
  4287. when ($MSVC == "yes" || $CYGWIN == "yes") {
  4288. _CPP_PROTO_MODULE_PREFIX=
  4289. _CPP_PROTO_MODULE_SUFFIX=.lib
  4290. }
  4291. otherwise {
  4292. _CPP_PROTO_MODULE_PREFIX=lib
  4293. _CPP_PROTO_MODULE_SUFFIX=.a
  4294. }
  4295. ### @usage: _EXPOSE(OutputsToExport...)
  4296. ###
  4297. ### Allows to mark outputs of macro command as unused in the current module but intended
  4298. ### to be used in modules consuming current via PEERDIR.
  4299. ###
  4300. ### TODO(DEVTOOLS-9000) proper implementation needed
  4301. macro _EXPOSE(Args...) {
  4302. .CMD=$YMAKE_PYTHON ${input:"build/scripts/touch.py"} ${output;suf=$_HASH_HELPER($Args).ya_exposed:"empty_"} ${input;hide:Args}
  4303. }
  4304. # tag:internal
  4305. ### @usage: _PROXY_LIBRARY() # internal
  4306. ###
  4307. ### The use of this module is strictly prohibited!!!
  4308. module _PROXY_LIBRARY: LIBRARY {
  4309. .EXTS=.a .lib
  4310. .PEERDIR_POLICY=as_build_from
  4311. .PROXY=yes
  4312. .FINAL_TARGET=yes
  4313. DISABLE(NEED_ADD_FAKE_SRC)
  4314. NO_UTIL()
  4315. NO_RUNTIME()
  4316. }
  4317. @import "${CONF_ROOT}/conf/project_specific/yql_udf.conf"
  4318. _PRIMARY_OUTPUT_VALUE=
  4319. # tag:internal
  4320. ### @usage: PRIMARY_OUTPUT_VALUE(Output) # internal
  4321. ###
  4322. ### The use of this module is strictly prohibited!!!
  4323. macro PRIMARY_OUTPUT(OUTPUT) {
  4324. SET(_PRIMARY_OUTPUT_VALUE $OUTPUT)
  4325. }
  4326. _DLL_PROXY_LIBRARY_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${input;hide:_PRIMARY_OUTPUT_VALUE} ${TARGET}
  4327. # tag:internal
  4328. ### @usage: DLL_PROXY_LIBRARY() # internal
  4329. ###
  4330. ### The use of this module is strictly prohibited!!!
  4331. module DLL_PROXY_LIBRARY: _PROXY_LIBRARY {
  4332. .ALLOWED=PRIMARY_OUTPUT
  4333. .CMD=_DLL_PROXY_LIBRARY_CMD
  4334. }
  4335. _PREBUILT_PROGRAM_CMD=$GENERATE_MF && $COPY_CMD $_PRIMARY_OUTPUT_VALUE ${TARGET} ${kv;hide:"p ld"} ${kv;hide:"pc light-blue"} ${kv;hide:"show_out"}
  4336. # tag:internal
  4337. ### @usage: PREBUILT_PROGRAM([programname]) # internal
  4338. ###
  4339. ### Program module which uses a prebuilt prgram as its output.
  4340. module PREBUILT_PROGRAM: _LINK_UNIT {
  4341. .CMD=_PREBUILT_PROGRAM_CMD
  4342. .SYMLINK_POLICY=EXE
  4343. .ALLOWED=INDUCED_DEPS PRIMARY_OUTPUT
  4344. .RESTRICTED=SRCS
  4345. _BARE_LINK_MODULE()
  4346. SET(MODULE_TYPE PROGRAM)
  4347. _DONT_REQUIRE_LICENSE()
  4348. when ($WIN32 == "yes" || $OS_CYGWIN == "yes") {
  4349. MODULE_SUFFIX=.exe
  4350. }
  4351. }
  4352. ### @usage COLLECT_JINJA_TEMPLATES(varname path)
  4353. ###
  4354. ### This macro collects all jinja and yaml files in the directory specified by second argument and
  4355. ### stores result in the variable with mane specified by first parameter.
  4356. macro COLLECT_JINJA_TEMPLATES(VAR, DIR) {
  4357. _GLOB($VAR ${DIR}/**/*.jinja ${DIR}/**/*.yaml)
  4358. }
  4359. @import "${CONF_ROOT}/conf/go.conf"
  4360. # Conflict between protobuf-java and protobuf-javalite ¯\_(ツ)_/¯
  4361. # both libraries are required by grpc
  4362. JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE=\
  4363. com.google.protobuf.AbstractMessageLite \
  4364. com.google.protobuf.AbstractMessageLite$Builder \
  4365. com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream \
  4366. com.google.protobuf.AbstractMessageLite$InternalOneOfEnum \
  4367. com.google.protobuf.AbstractParser \
  4368. com.google.protobuf.AbstractProtobufList \
  4369. com.google.protobuf.AllocatedBuffer \
  4370. com.google.protobuf.AllocatedBuffer$1 \
  4371. com.google.protobuf.AllocatedBuffer$2 \
  4372. com.google.protobuf.Android \
  4373. com.google.protobuf.Any \
  4374. com.google.protobuf.Any$1 \
  4375. com.google.protobuf.Any$Builder \
  4376. com.google.protobuf.AnyOrBuilder \
  4377. com.google.protobuf.AnyProto \
  4378. com.google.protobuf.Api \
  4379. com.google.protobuf.Api$1 \
  4380. com.google.protobuf.Api$Builder \
  4381. com.google.protobuf.ApiOrBuilder \
  4382. com.google.protobuf.ApiProto \
  4383. com.google.protobuf.ArrayDecoders \
  4384. com.google.protobuf.ArrayDecoders$1 \
  4385. com.google.protobuf.ArrayDecoders$Registers \
  4386. com.google.protobuf.BinaryReader \
  4387. com.google.protobuf.BinaryReader$1 \
  4388. com.google.protobuf.BinaryReader$SafeHeapReader \
  4389. com.google.protobuf.BinaryWriter \
  4390. com.google.protobuf.BinaryWriter$1 \
  4391. com.google.protobuf.BinaryWriter$SafeDirectWriter \
  4392. com.google.protobuf.BinaryWriter$SafeHeapWriter \
  4393. com.google.protobuf.BinaryWriter$UnsafeDirectWriter \
  4394. com.google.protobuf.BinaryWriter$UnsafeHeapWriter \
  4395. com.google.protobuf.BooleanArrayList \
  4396. com.google.protobuf.BoolValue \
  4397. com.google.protobuf.BoolValue$1 \
  4398. com.google.protobuf.BoolValue$Builder \
  4399. com.google.protobuf.BoolValueOrBuilder \
  4400. com.google.protobuf.BufferAllocator \
  4401. com.google.protobuf.BufferAllocator$1 \
  4402. com.google.protobuf.ByteBufferWriter \
  4403. com.google.protobuf.ByteOutput \
  4404. com.google.protobuf.ByteString \
  4405. com.google.protobuf.ByteString$1 \
  4406. com.google.protobuf.ByteString$2 \
  4407. com.google.protobuf.ByteString$AbstractByteIterator \
  4408. com.google.protobuf.ByteString$ArraysByteArrayCopier \
  4409. com.google.protobuf.ByteString$BoundedByteString \
  4410. com.google.protobuf.ByteString$ByteArrayCopier \
  4411. com.google.protobuf.ByteString$ByteIterator \
  4412. com.google.protobuf.ByteString$CodedBuilder \
  4413. com.google.protobuf.ByteString$LeafByteString \
  4414. com.google.protobuf.ByteString$LiteralByteString \
  4415. com.google.protobuf.ByteString$Output \
  4416. com.google.protobuf.ByteString$SystemByteArrayCopier \
  4417. com.google.protobuf.BytesValue \
  4418. com.google.protobuf.BytesValue$1 \
  4419. com.google.protobuf.BytesValue$Builder \
  4420. com.google.protobuf.BytesValueOrBuilder \
  4421. com.google.protobuf.CanIgnoreReturnValue \
  4422. com.google.protobuf.CheckReturnValue \
  4423. com.google.protobuf.CodedInputStream \
  4424. com.google.protobuf.CodedInputStream$1 \
  4425. com.google.protobuf.CodedInputStream$ArrayDecoder \
  4426. com.google.protobuf.CodedInputStream$IterableDirectByteBufferDecoder \
  4427. com.google.protobuf.CodedInputStream$StreamDecoder \
  4428. com.google.protobuf.CodedInputStream$StreamDecoder$RefillCallback \
  4429. com.google.protobuf.CodedInputStream$StreamDecoder$SkippedDataSink \
  4430. com.google.protobuf.CodedInputStream$UnsafeDirectNioDecoder \
  4431. com.google.protobuf.CodedInputStreamReader \
  4432. com.google.protobuf.CodedInputStreamReader$1 \
  4433. com.google.protobuf.CodedOutputStream \
  4434. com.google.protobuf.CodedOutputStream$1 \
  4435. com.google.protobuf.CodedOutputStream$AbstractBufferedEncoder \
  4436. com.google.protobuf.CodedOutputStream$ArrayEncoder \
  4437. com.google.protobuf.CodedOutputStream$ByteOutputEncoder \
  4438. com.google.protobuf.CodedOutputStream$HeapNioEncoder \
  4439. com.google.protobuf.CodedOutputStream$OutOfSpaceException \
  4440. com.google.protobuf.CodedOutputStream$OutputStreamEncoder \
  4441. com.google.protobuf.CodedOutputStream$SafeDirectNioEncoder \
  4442. com.google.protobuf.CodedOutputStream$UnsafeDirectNioEncoder \
  4443. com.google.protobuf.CodedOutputStreamWriter \
  4444. com.google.protobuf.CodedOutputStreamWriter$1 \
  4445. com.google.protobuf.DoubleArrayList \
  4446. com.google.protobuf.DoubleValue \
  4447. com.google.protobuf.DoubleValue$1 \
  4448. com.google.protobuf.DoubleValue$Builder \
  4449. com.google.protobuf.DoubleValueOrBuilder \
  4450. com.google.protobuf.Duration \
  4451. com.google.protobuf.Duration$1 \
  4452. com.google.protobuf.Duration$Builder \
  4453. com.google.protobuf.DurationOrBuilder \
  4454. com.google.protobuf.DurationProto \
  4455. com.google.protobuf.Empty \
  4456. com.google.protobuf.Empty$1 \
  4457. com.google.protobuf.Empty$Builder \
  4458. com.google.protobuf.EmptyOrBuilder \
  4459. com.google.protobuf.EmptyProto \
  4460. com.google.protobuf.Enum \
  4461. com.google.protobuf.Enum$1 \
  4462. com.google.protobuf.Enum$Builder \
  4463. com.google.protobuf.EnumOrBuilder \
  4464. com.google.protobuf.EnumValue \
  4465. com.google.protobuf.EnumValue$1 \
  4466. com.google.protobuf.EnumValue$Builder \
  4467. com.google.protobuf.EnumValueOrBuilder \
  4468. com.google.protobuf.ExperimentalApi \
  4469. com.google.protobuf.ExtensionLite \
  4470. com.google.protobuf.ExtensionRegistryFactory \
  4471. com.google.protobuf.ExtensionRegistryLite \
  4472. com.google.protobuf.ExtensionRegistryLite$ExtensionClassHolder \
  4473. com.google.protobuf.ExtensionRegistryLite$ObjectIntPair \
  4474. com.google.protobuf.ExtensionSchema \
  4475. com.google.protobuf.ExtensionSchemaLite \
  4476. com.google.protobuf.ExtensionSchemaLite$1 \
  4477. com.google.protobuf.ExtensionSchemas \
  4478. com.google.protobuf.Field \
  4479. com.google.protobuf.Field$1 \
  4480. com.google.protobuf.Field$Builder \
  4481. com.google.protobuf.Field$Cardinality \
  4482. com.google.protobuf.Field$Cardinality$1 \
  4483. com.google.protobuf.Field$Kind \
  4484. com.google.protobuf.Field$Kind$1 \
  4485. com.google.protobuf.FieldInfo \
  4486. com.google.protobuf.FieldInfo$1 \
  4487. com.google.protobuf.FieldInfo$Builder \
  4488. com.google.protobuf.FieldMask \
  4489. com.google.protobuf.FieldMask$1 \
  4490. com.google.protobuf.FieldMask$Builder \
  4491. com.google.protobuf.FieldMaskOrBuilder \
  4492. com.google.protobuf.FieldMaskProto \
  4493. com.google.protobuf.FieldOrBuilder \
  4494. com.google.protobuf.FieldSet \
  4495. com.google.protobuf.FieldSet$1 \
  4496. com.google.protobuf.FieldSet$Builder \
  4497. com.google.protobuf.FieldSet$FieldDescriptorLite \
  4498. com.google.protobuf.FieldType \
  4499. com.google.protobuf.FieldType$1 \
  4500. com.google.protobuf.FieldType$Collection \
  4501. com.google.protobuf.FloatArrayList \
  4502. com.google.protobuf.FloatValue \
  4503. com.google.protobuf.FloatValue$1 \
  4504. com.google.protobuf.FloatValue$Builder \
  4505. com.google.protobuf.FloatValueOrBuilder \
  4506. com.google.protobuf.GeneratedMessageInfoFactory \
  4507. com.google.protobuf.GeneratedMessageLite \
  4508. com.google.protobuf.GeneratedMessageLite$1 \
  4509. com.google.protobuf.GeneratedMessageLite$Builder \
  4510. com.google.protobuf.GeneratedMessageLite$DefaultInstanceBasedParser \
  4511. com.google.protobuf.GeneratedMessageLite$ExtendableBuilder \
  4512. com.google.protobuf.GeneratedMessageLite$ExtendableMessage \
  4513. com.google.protobuf.GeneratedMessageLite$ExtendableMessage$ExtensionWriter \
  4514. com.google.protobuf.GeneratedMessageLite$ExtendableMessageOrBuilder \
  4515. com.google.protobuf.GeneratedMessageLite$ExtensionDescriptor \
  4516. com.google.protobuf.GeneratedMessageLite$GeneratedExtension \
  4517. com.google.protobuf.GeneratedMessageLite$MethodToInvoke \
  4518. com.google.protobuf.GeneratedMessageLite$SerializedForm \
  4519. com.google.protobuf.Int32Value \
  4520. com.google.protobuf.Int32Value$1 \
  4521. com.google.protobuf.Int32Value$Builder \
  4522. com.google.protobuf.Int32ValueOrBuilder \
  4523. com.google.protobuf.Int64Value \
  4524. com.google.protobuf.Int64Value$1 \
  4525. com.google.protobuf.Int64Value$Builder \
  4526. com.google.protobuf.Int64ValueOrBuilder \
  4527. com.google.protobuf.IntArrayList \
  4528. com.google.protobuf.Internal \
  4529. com.google.protobuf.Internal$BooleanList \
  4530. com.google.protobuf.Internal$DoubleList \
  4531. com.google.protobuf.Internal$EnumLite \
  4532. com.google.protobuf.Internal$EnumLiteMap \
  4533. com.google.protobuf.Internal$EnumVerifier \
  4534. com.google.protobuf.Internal$FloatList \
  4535. com.google.protobuf.Internal$IntList \
  4536. com.google.protobuf.Internal$ListAdapter \
  4537. com.google.protobuf.Internal$ListAdapter$Converter \
  4538. com.google.protobuf.Internal$LongList \
  4539. com.google.protobuf.Internal$MapAdapter \
  4540. com.google.protobuf.Internal$MapAdapter$1 \
  4541. com.google.protobuf.Internal$MapAdapter$Converter \
  4542. com.google.protobuf.Internal$MapAdapter$EntryAdapter \
  4543. com.google.protobuf.Internal$MapAdapter$IteratorAdapter \
  4544. com.google.protobuf.Internal$MapAdapter$SetAdapter \
  4545. com.google.protobuf.Internal$ProtobufList \
  4546. com.google.protobuf.InvalidProtocolBufferException \
  4547. com.google.protobuf.InvalidProtocolBufferException$InvalidWireTypeException \
  4548. com.google.protobuf.IterableByteBufferInputStream \
  4549. com.google.protobuf.JavaType \
  4550. com.google.protobuf.LazyField \
  4551. com.google.protobuf.LazyField$1 \
  4552. com.google.protobuf.LazyField$LazyEntry \
  4553. com.google.protobuf.LazyField$LazyIterator \
  4554. com.google.protobuf.LazyFieldLite \
  4555. com.google.protobuf.LazyStringArrayList \
  4556. com.google.protobuf.LazyStringArrayList$ByteArrayListView \
  4557. com.google.protobuf.LazyStringArrayList$ByteStringListView \
  4558. com.google.protobuf.LazyStringList \
  4559. com.google.protobuf.ListFieldSchema \
  4560. com.google.protobuf.ListFieldSchema$1 \
  4561. com.google.protobuf.ListFieldSchema$ListFieldSchemaFull \
  4562. com.google.protobuf.ListFieldSchema$ListFieldSchemaLite \
  4563. com.google.protobuf.ListValue \
  4564. com.google.protobuf.ListValue$1 \
  4565. com.google.protobuf.ListValue$Builder \
  4566. com.google.protobuf.ListValueOrBuilder \
  4567. com.google.protobuf.LongArrayList \
  4568. com.google.protobuf.ManifestSchemaFactory \
  4569. com.google.protobuf.ManifestSchemaFactory$1 \
  4570. com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory \
  4571. com.google.protobuf.MapEntryLite \
  4572. com.google.protobuf.MapEntryLite$1 \
  4573. com.google.protobuf.MapEntryLite$Metadata \
  4574. com.google.protobuf.MapFieldLite \
  4575. com.google.protobuf.MapFieldSchema \
  4576. com.google.protobuf.MapFieldSchemaLite \
  4577. com.google.protobuf.MapFieldSchemas \
  4578. com.google.protobuf.MessageInfo \
  4579. com.google.protobuf.MessageInfoFactory \
  4580. com.google.protobuf.MessageLite \
  4581. com.google.protobuf.MessageLite$Builder \
  4582. com.google.protobuf.MessageLiteOrBuilder \
  4583. com.google.protobuf.MessageLiteToString \
  4584. com.google.protobuf.MessageSchema \
  4585. com.google.protobuf.MessageSchema$1 \
  4586. com.google.protobuf.MessageSetSchema \
  4587. com.google.protobuf.Method \
  4588. com.google.protobuf.Method$1 \
  4589. com.google.protobuf.Method$Builder \
  4590. com.google.protobuf.MethodOrBuilder \
  4591. com.google.protobuf.Mixin \
  4592. com.google.protobuf.Mixin$1 \
  4593. com.google.protobuf.Mixin$Builder \
  4594. com.google.protobuf.MixinOrBuilder \
  4595. com.google.protobuf.MutabilityOracle \
  4596. com.google.protobuf.MutabilityOracle$1 \
  4597. com.google.protobuf.NewInstanceSchema \
  4598. com.google.protobuf.NewInstanceSchemaLite \
  4599. com.google.protobuf.NewInstanceSchemas \
  4600. com.google.protobuf.NioByteString \
  4601. com.google.protobuf.NioByteString$1 \
  4602. com.google.protobuf.NullValue \
  4603. com.google.protobuf.NullValue$1 \
  4604. com.google.protobuf.OneofInfo \
  4605. com.google.protobuf.Option \
  4606. com.google.protobuf.Option$1 \
  4607. com.google.protobuf.Option$Builder \
  4608. com.google.protobuf.OptionOrBuilder \
  4609. com.google.protobuf.Parser \
  4610. com.google.protobuf.PrimitiveNonBoxingCollection \
  4611. com.google.protobuf.Protobuf \
  4612. com.google.protobuf.ProtobufArrayList \
  4613. com.google.protobuf.ProtobufLists \
  4614. com.google.protobuf.ProtocolStringList \
  4615. com.google.protobuf.ProtoSyntax \
  4616. com.google.protobuf.RawMessageInfo \
  4617. com.google.protobuf.Reader \
  4618. com.google.protobuf.RopeByteString \
  4619. com.google.protobuf.RopeByteString$1 \
  4620. com.google.protobuf.RopeByteString$Balancer \
  4621. com.google.protobuf.RopeByteString$PieceIterator \
  4622. com.google.protobuf.RopeByteString$RopeInputStream \
  4623. com.google.protobuf.Schema \
  4624. com.google.protobuf.SchemaFactory \
  4625. com.google.protobuf.SchemaUtil \
  4626. com.google.protobuf.SmallSortedMap \
  4627. com.google.protobuf.SmallSortedMap$1 \
  4628. com.google.protobuf.SmallSortedMap$DescendingEntryIterator \
  4629. com.google.protobuf.SmallSortedMap$DescendingEntrySet \
  4630. com.google.protobuf.SmallSortedMap$EmptySet \
  4631. com.google.protobuf.SmallSortedMap$EmptySet$1 \
  4632. com.google.protobuf.SmallSortedMap$EmptySet$2 \
  4633. com.google.protobuf.SmallSortedMap$Entry \
  4634. com.google.protobuf.SmallSortedMap$EntryIterator \
  4635. com.google.protobuf.SmallSortedMap$EntrySet \
  4636. com.google.protobuf.SourceContext \
  4637. com.google.protobuf.SourceContext$1 \
  4638. com.google.protobuf.SourceContext$Builder \
  4639. com.google.protobuf.SourceContextOrBuilder \
  4640. com.google.protobuf.SourceContextProto \
  4641. com.google.protobuf.StringValue \
  4642. com.google.protobuf.StringValue$1 \
  4643. com.google.protobuf.StringValue$Builder \
  4644. com.google.protobuf.StringValueOrBuilder \
  4645. com.google.protobuf.Struct \
  4646. com.google.protobuf.Struct$1 \
  4647. com.google.protobuf.Struct$Builder \
  4648. com.google.protobuf.Struct$FieldsDefaultEntryHolder \
  4649. com.google.protobuf.StructOrBuilder \
  4650. com.google.protobuf.StructProto \
  4651. com.google.protobuf.StructuralMessageInfo \
  4652. com.google.protobuf.StructuralMessageInfo$Builder \
  4653. com.google.protobuf.Syntax \
  4654. com.google.protobuf.Syntax$1 \
  4655. com.google.protobuf.TextFormatEscaper \
  4656. com.google.protobuf.TextFormatEscaper$1 \
  4657. com.google.protobuf.TextFormatEscaper$2 \
  4658. com.google.protobuf.TextFormatEscaper$ByteSequence \
  4659. com.google.protobuf.Timestamp \
  4660. com.google.protobuf.Timestamp$1 \
  4661. com.google.protobuf.Timestamp$Builder \
  4662. com.google.protobuf.TimestampOrBuilder \
  4663. com.google.protobuf.TimestampProto \
  4664. com.google.protobuf.Type \
  4665. com.google.protobuf.Type$1 \
  4666. com.google.protobuf.Type$Builder \
  4667. com.google.protobuf.TypeOrBuilder \
  4668. com.google.protobuf.TypeProto \
  4669. com.google.protobuf.UInt32Value \
  4670. com.google.protobuf.UInt32Value$1 \
  4671. com.google.protobuf.UInt32Value$Builder \
  4672. com.google.protobuf.UInt32ValueOrBuilder \
  4673. com.google.protobuf.UInt64Value \
  4674. com.google.protobuf.UInt64Value$1 \
  4675. com.google.protobuf.UInt64Value$Builder \
  4676. com.google.protobuf.UInt64ValueOrBuilder \
  4677. com.google.protobuf.UninitializedMessageException \
  4678. com.google.protobuf.UnknownFieldSchema \
  4679. com.google.protobuf.UnknownFieldSetLite \
  4680. com.google.protobuf.UnknownFieldSetLiteSchema \
  4681. com.google.protobuf.UnmodifiableLazyStringList \
  4682. com.google.protobuf.UnmodifiableLazyStringList$1 \
  4683. com.google.protobuf.UnmodifiableLazyStringList$2 \
  4684. com.google.protobuf.UnsafeByteOperations \
  4685. com.google.protobuf.UnsafeUtil \
  4686. com.google.protobuf.UnsafeUtil$1 \
  4687. com.google.protobuf.UnsafeUtil$Android32MemoryAccessor \
  4688. com.google.protobuf.UnsafeUtil$Android64MemoryAccessor \
  4689. com.google.protobuf.UnsafeUtil$JvmMemoryAccessor \
  4690. com.google.protobuf.UnsafeUtil$MemoryAccessor \
  4691. com.google.protobuf.Utf8 \
  4692. com.google.protobuf.Utf8$DecodeUtil \
  4693. com.google.protobuf.Utf8$Processor \
  4694. com.google.protobuf.Utf8$SafeProcessor \
  4695. com.google.protobuf.Utf8$UnpairedSurrogateException \
  4696. com.google.protobuf.Utf8$UnsafeProcessor \
  4697. com.google.protobuf.Value \
  4698. com.google.protobuf.Value$1 \
  4699. com.google.protobuf.Value$Builder \
  4700. com.google.protobuf.Value$KindCase \
  4701. com.google.protobuf.ValueOrBuilder \
  4702. com.google.protobuf.WireFormat \
  4703. com.google.protobuf.WireFormat$1 \
  4704. com.google.protobuf.WireFormat$FieldType \
  4705. com.google.protobuf.WireFormat$FieldType$1 \
  4706. com.google.protobuf.WireFormat$FieldType$2 \
  4707. com.google.protobuf.WireFormat$FieldType$3 \
  4708. com.google.protobuf.WireFormat$FieldType$4 \
  4709. com.google.protobuf.WireFormat$JavaType \
  4710. com.google.protobuf.WireFormat$Utf8Validation \
  4711. com.google.protobuf.WireFormat$Utf8Validation$1 \
  4712. com.google.protobuf.WireFormat$Utf8Validation$2 \
  4713. com.google.protobuf.WireFormat$Utf8Validation$3 \
  4714. com.google.protobuf.WrappersProto \
  4715. com.google.protobuf.Writer \
  4716. com.google.protobuf.Writer$FieldOrder
  4717. # tag:java-specific
  4718. JAVA_IGNORE_CLASSPATH_CLASH_VALUE=$JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE
  4719. ### @usage: JAVA_IGNORE_CLASSPATH_CLASH_FOR([classes])
  4720. ### Ignore classpath clash test fails for classes
  4721. macro JAVA_IGNORE_CLASSPATH_CLASH_FOR(Args...) {
  4722. SET_APPEND(JAVA_IGNORE_CLASSPATH_CLASH_VALUE $Args $JAVA_IGNORE_CLASSPATH_CLASH_DEFAULE_VALUE)
  4723. }
  4724. IBTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  4725. # tag:src-processing
  4726. STORYBOARD_FLAGS=--errors --warnings --notices --auto-activate-custom-fonts --output-format human-readable-text
  4727. macro _SRC("storyboard", SRC, SRCFLAGS...) {
  4728. .CMD=$IBTOOL_PATH $STORYBOARD_FLAGS --module $REALPRJNAME --output-partial-info-plist ${output;suf=.partial_plist:SRC} --compilation-directory $BINDIR ${input:SRC} && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.compiled_storyboard_tar:SRC} $BINDIR/${nopath;suf=c:SRC} $BINDIR/${nopath;suf=c:SRC}
  4729. }
  4730. # tag:src-processing
  4731. macro _SRC("xib", SRC, SRCFLAGS...) {
  4732. .CMD=$IBTOOL_PATH $STORYBOARD_FLAGS --module $REALPRJNAME --output-partial-info-plist ${output;suf=.partial_plist:SRC} --compile ${output;tobindir;nopath;noext;suf=.nib:SRC} ${input:SRC}
  4733. }
  4734. ACTOOL_PATH=$XCODE_TOOLS_ROOT_RESOURCE_GLOBAL/Xcode/Contents/Developer/usr/bin/ibtool
  4735. # tag:ios-specific
  4736. ASSETS_FLAGS=--output-format human-readable-text --notices --warnings
  4737. macro _IOS_ASSETS(AssetsDir, Content...) {
  4738. .CMD=$FS_TOOLS md $BINDIR/$REALPRJNAME && $ACTOOL_PATH $ASSETS_FLAGS --export-dependency-info $BINDIR/assetcatalog_dependencies --output-partial-info-plist ${output:"assetcatalog_generated_info.partial_plist"} --product-type com.apple.product-type.application --compile $BINDIR/$REALPRJNAME $AssetsDir ${input;hide:Content} && ${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;suf=_assetes.resource_tar:REALPRJNAME} $REALPRJNAME $REALPRJNAME
  4739. }
  4740. # tag:ios-specific
  4741. macro IOS_APP_COMMON_FLAGS(Flags...) {
  4742. SET_APPEND(STORYBOARD_FLAGS $Flags)
  4743. SET_APPEND(ASSETS_FLAGS $Flags)
  4744. }
  4745. # tag:ios-specific
  4746. macro IOS_APP_ASSETS_FLAGS(Flags...) {
  4747. SET_APPEND(ASSETS_FLAGS $Flags)
  4748. }
  4749. macro DARWIN_STRINGS_RESOURCE(Resource, Relpath) {
  4750. .CMD=$COPY_CMD ${input:Resource} $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.strings_tar:Relpath} $BINDIR/$Relpath $BINDIR
  4751. }
  4752. macro DARWIN_SIGNED_RESOURCE(Resource, Relpath) {
  4753. .CMD=$COPY_CMD $Resource $BINDIR/$Relpath && $YMAKE_PYTHON ${input:"build/scripts/tar_directory.py"} ${output;tobindir;suf=.signed_resource_tar:Relpath} $BINDIR/$Relpath $BINDIR
  4754. }
  4755. # tag:ios-specific
  4756. DELIM=__DELIM__
  4757. PACK_IOS_ARCHIVE=$GENERATE_MF && $YMAKE_PYTHON ${input:"build/scripts/ios_wrapper.py"} bin $IBTOOL_PATH $TARGET $REALPRJNAME $BINDIR $DELIM $AUTO_INPUT $DELIM $STORYBOARD_FLAGS
  4758. ### @usage: IOS_INTERFACE()
  4759. ### iOS GUI module definition
  4760. module IOS_INTERFACE: _BARE_UNIT {
  4761. .CMD=PACK_IOS_ARCHIVE
  4762. .EXTS=.compiled_storyboard_tar .partial_plist .plist .xcent .nib .resource_tar .signed_resource_tar .strings_tar .plist_json
  4763. .NODE_TYPE=Library
  4764. .FINAL_TARGET=no
  4765. SET(MODULE_SUFFIX .ios.interface)
  4766. PEERDIR+=build/platform/xcode/tools
  4767. }
  4768. # tag:ios-specific
  4769. module DEFAULT_IOS_INTERFACE: IOS_INTERFACE {
  4770. SET(MODULE_SUFFIX .default.ios.interface)
  4771. }
  4772. DEFAULT_IOS_TYPE=
  4773. IOS_TYPE=
  4774. when(!$IOS_TYPE) {
  4775. when($DEFAULT_IOS_TYPE) {
  4776. IOS_TYPE=$DEFAULT_IOS_TYPE
  4777. }
  4778. otherwise {
  4779. IOS_TYPE=com.apple.CoreSimulator.SimDeviceType.iPhone-X
  4780. }
  4781. }
  4782. DEFAULT_IOS_RUNTIME=
  4783. IOS_RUNTIME=
  4784. when(!$IOS_RUNTIME) {
  4785. when($DEFAULT_IOS_RUNTIME) {
  4786. IOS_RUNTIME=$DEFAULT_IOS_RUNTIME
  4787. }
  4788. otherwise {
  4789. IOS_RUNTIME=com.apple.CoreSimulator.SimRuntime.iOS-12-1
  4790. }
  4791. }
  4792. when ($ARCH_I386) {
  4793. TEST_IOS_DEVICE_TYPE_VALUE=com.apple.CoreSimulator.SimDeviceType.iPhone-5
  4794. TEST_IOS_RUNTIME_TYPE_VALUE=com.apple.CoreSimulator.SimRuntime.iOS-10-3
  4795. }
  4796. otherwise {
  4797. TEST_IOS_DEVICE_TYPE_VALUE=$IOS_TYPE
  4798. TEST_IOS_RUNTIME_TYPE_VALUE=$IOS_RUNTIME
  4799. }
  4800. # tag:frontend-specific
  4801. ### @usage: COLLECT_FRONTEND_FILES(Varname, Dir)
  4802. ###
  4803. ### Recursively collect files with typical frontend extensions from Dir and save the result into variable Varname
  4804. macro COLLECT_FRONTEND_FILES(Varname, Dir) {
  4805. _GLOB($Varname $Dir/**/*.(css|ejs|jpg|js|jsx|png|styl|svg|ts|tsx|json|html))
  4806. }
  4807. # tag:swift-specific
  4808. CPP_XCODE_TOOLCHAIN_VERSION=9.2
  4809. SWIFT_XCODE_TOOLCHAIN_VERSION=9.2
  4810. XCODE_TOOLS_VERSION=10.1
  4811. macro COMPILE_SWIFT_MODULE(SRCS{input}[], BRIDGE_HEADER{input}="", Flags...) {
  4812. when ($BRIDGE_HEADER != "") {
  4813. SWIFT_BRIDGE_HEADER=-import-objc-header ${input:BRIDGE_HEADER}
  4814. }
  4815. otherwise {
  4816. SWIFT_BRIDGE_HEADER=
  4817. }
  4818. .PEERDIR+=build/platform/xcode/swift
  4819. # swift core libraries
  4820. LDFLAGS($SWIFT_LD_FLAGS)
  4821. .CMD=$YMAKE_PYTHON ${input:"build/scripts/gen_swiftc_output_map.py"} $(SOURCE_ROOT) $(BUILD_ROOT) $BINDIR/swift_output_map.json ${input:SRCS} && $SWIFT_COMPILER -c $SWIFT_FLAGS_PLATFORM $Flags $SWIFT_BRIDGE_HEADER ${pre=-Xcc -I:_C__INCLUDE} ${input:SRCS} -emit-objc-header -emit-objc-header-path ${output;suf=-Swift.h:REALPRJNAME} -emit-module -module-name $REALPRJNAME -output-file-map $BINDIR/swift_output_map.json ${output;hide;suf=.o:SRCS}
  4822. }
  4823. TEST_TOOL_HOST_LOCAL=
  4824. TEST_TOOL_TARGET_LOCAL=
  4825. when ($MOST_USED_CUDA) {
  4826. CUDA_VERSION=11.4
  4827. CUDNN_VERSION=8.0.5
  4828. TENSORRT_VERSION=7
  4829. }
  4830. when ($TENSORFLOW_WITH_CUDA) {
  4831. CUDA_REQUIRED=yes
  4832. }
  4833. when (!$TENSORRT_VERSION) {
  4834. TENSORRT_VERSION=5
  4835. }
  4836. ANDROID_APK_TEST_ACTIVITY_VALUE=com.yandex.test.unittests/.RunTestsActivity
  4837. # tag:windows-specific
  4838. WINDOWS_MANIFEST=
  4839. macro WINDOWS_MANIFEST(Manifest) {
  4840. SET(WINDOWS_MANIFEST $Manifest)
  4841. }
  4842. # https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation#enable-long-paths-in-windows-10-version-1607-and-later
  4843. macro WINDOWS_LONG_PATH_MANIFEST() {
  4844. SET(WINDOWS_MANIFEST build/long-path.manifest)
  4845. }
  4846. # tag:windows-specific
  4847. when ($MSVC == "yes" && $WINDOWS_MANIFEST) {
  4848. LDFLAGS+=/MANIFEST:EMBED /MANIFESTINPUT:${input:WINDOWS_MANIFEST}
  4849. }
  4850. # tag:cpp-specific
  4851. _VISIBILITY_LEVEL=
  4852. ### @usage: VISIBILITY(level)
  4853. ###
  4854. ### This macro sets visibility level for symbols compiled for the current module. 'level'
  4855. ### may take only one of the following values: DEFAULT, HIDDEN.
  4856. macro VISIBILITY(LEVEL) {
  4857. SET(_VISIBILITY_LEVEL ${LEVEL})
  4858. select ($LEVEL) {
  4859. "DEFAULT" | "HIDDEN" ? {
  4860. }
  4861. default ? {
  4862. _OK = no
  4863. }
  4864. }
  4865. ASSERT(_OK Unsupported value [$LEVEL] passed to VISIBILITY macro, expected values are DEFAULT, HIDDEN.)
  4866. }
  4867. # tag:cpp-specific
  4868. _CFLAGS_VISIBILITY=
  4869. when ($_VISIBILITY_LEVEL != "" && $IGNORE_VISIBILITY != "yes") {
  4870. when ($CLANG == "yes" || $GCC == "yes") {
  4871. _CFLAGS_VISIBILITY=-fvisibility=${tolower:_VISIBILITY_LEVEL}
  4872. }
  4873. }
  4874. CFLAGS+=$_CFLAGS_VISIBILITY
  4875. # tag:cpp-specific
  4876. macro SDBUS_CPP_ADAPTOR(File) {
  4877. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --adaptor=${output;nopath;noext:File.adaptor.h} ${input:File}
  4878. .PEERDIR=contrib/libs/sdbus-cpp
  4879. }
  4880. # tag:cpp-specific
  4881. macro SDBUS_CPP_PROXY(File) {
  4882. .CMD=${tool:"contrib/libs/sdbus-cpp/tools/xml2cpp-codegen"} --proxy=${output;nopath;noext:File.proxy.h} ${input:File}
  4883. .PEERDIR=contrib/libs/sdbus-cpp
  4884. }
  4885. # tag:python-specific
  4886. macro _PY_ENUM_SERIALIZATION_TO_JSON(File) {
  4887. .CMD=$ENUM_PARSER_TOOL ${input:File} --output ${output;noext;suf=.generated.h:File} --json-output ${output;noext:File.json} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  4888. }
  4889. # tag:python-specific
  4890. macro _PY_ENUM_SERIALIZATION_TO_PY(File) {
  4891. .CMD=${tool:"metrika/core/tools/python_enum_generator"} ${input;noext:File.json} -D ${MODDIR} --output ${output;noext:File.py} ${kv;hide:"p EN"} ${kv;hide:"pc yellow"}
  4892. }
  4893. macro NGINX_MODULES(Modules...) {
  4894. PEERDIR(${Modules})
  4895. RUN_PROGRAM(nginx/module_gen ${Modules} CWD ${ARCADIA_ROOT} IN ${suf=/modules.json:Modules} OUTPUT_INCLUDES contrib/nginx/core/src/core/ngx_config.h contrib/nginx/core/src/core/ngx_core.h STDOUT ngx_modules.c)
  4896. }
  4897. ### @usage: ORIGINAL_SOURCE(Source)
  4898. ###
  4899. ### This macro specifies the source repository for contrib
  4900. ### Does nothing now (just a placeholder for future functionality)
  4901. ### See https://st.yandex-team.ru/DTCC-316
  4902. macro ORIGINAL_SOURCE(Source) {
  4903. ENABLE(UNUSED_MACRO)
  4904. }
  4905. # tag:licence
  4906. CREDITS_FILE_EXTRA_EXT=
  4907. CREDITS_FLAGS=
  4908. CREDITS_TEXTS_FILE=
  4909. NO_CREDITS_TEXTS_FILE=
  4910. WITH_CREDITS=
  4911. ### @usage: LICENSE_TEXTS(File)
  4912. ###
  4913. ### This macro specifies the filename with all library licenses texts
  4914. macro LICENSE_TEXTS(Source) {
  4915. SET(CREDITS_TEXTS_FILE $Source)
  4916. }
  4917. # tag:licence
  4918. ### @usage: WITHOUT_LICENSE_TEXTS()
  4919. ###
  4920. ### This macro indicates that the module has no license text
  4921. macro WITHOUT_LICENSE_TEXTS() {
  4922. ENABLE(NO_CREDITS_TEXTS_FILE)
  4923. }
  4924. # tag:licence
  4925. when ($WITH_CREDITS) {
  4926. CREDITS_FLAGS+=--credits-output ${output;suf=${CREDITS_FILE_EXTRA_EXT}".CREDITS.txt":REALPRJNAME}
  4927. }
  4928. GENERATE_MF=
  4929. when ($WITH_CREDITS) {
  4930. GENERATE_MF=$GENERATE_MF_CMD
  4931. }
  4932. macro _MCU_CONVERT(Bin) {
  4933. .CMD=${cwd:BINDIR} $OBJCOPY_TOOL -O ihex $Bin ${output;noext:Bin.hex} && ${cwd:BINDIR} $OBJCOPY_TOOL -O srec $Bin ${output;noext:Bin.s37} && ${cwd:BINDIR} $OBJCOPY_TOOL -O binary $Bin ${output;noext:Bin.bin}
  4934. }
  4935. MCU_LINK_EXE=$LINK_EXE && $_MCU_CONVERT($MODULE_PREFIX$REALPRJNAME)
  4936. ### @usage: MCU_PROGRAM([progname])
  4937. ###
  4938. ### Program module for microcontrollers. Converts ELF to Intel HEX, Motorola S-record and raw binary file formats.
  4939. ### If name is not specified it will be generated from the name of the containing project directory.
  4940. module MCU_PROGRAM: PROGRAM {
  4941. .CMD=MCU_LINK_EXE
  4942. }
  4943. # tag:flags tag:internal tag:windows-specific
  4944. ### @usage: _MSVC_FLAGS_WINDOWS_IMPL(target_platform compiler_flags) # internal
  4945. ###
  4946. ### Add CFLAGS when the firts argument is WINDOWS
  4947. macro _MSVC_FLAGS_WINDOWS_IMPL(WINDOWS[], FLAGS...) {
  4948. CFLAGS($WINDOWS)
  4949. }
  4950. # tag:flags tag:windows-specific tag:cpp-specific
  4951. ### @usage: MSVC_FLAGS([GLOBAL compiler_flag]* compiler_flags)
  4952. ###
  4953. ### Add the specified flags to the compilation line of C/C++files.
  4954. ### Flags apply only if the compiler used is MSVC (cl.exe)
  4955. macro MSVC_FLAGS(FLAGS...) {
  4956. _MSVC_FLAGS_WINDOWS_IMPL($TARGET_PLATFORM $FLAGS)
  4957. }
  4958. ### @usage: COLLECT_YDB_API_SPECS_LEGACY(VarName Paths...) #deprecated
  4959. ###
  4960. ### This macro is ugly hack for legacy YDB go API codegen, any other uses are prohibited
  4961. macro COLLECT_YDB_API_SPECS_LEGACY(FILES_VAR, PATHS...) {
  4962. _GLOB($FILES_VAR ${suf=/*.proto:PATHS})
  4963. RESTRICT_PATH(kikimr/public/sdk/go/ydb/api MSG This is ugly hack for legacy YDB go API codegen, any other uses are probibited)
  4964. }
  4965. # tag:proto tag:apphost
  4966. ### @usage: APPHOST()
  4967. ###
  4968. ### Emit APPHOST service code for all .proto files in a PROTO_LIBRARY.
  4969. ### This works only for C++ and Java at the moment.
  4970. macro APPHOST() {
  4971. # C++
  4972. CPP_PROTO_PLUGIN(cpp_plugin apphost/tools/stub_generator/cpp_plugin .apphost.h DEPS apphost/tools/stub_generator/cpp_includes)
  4973. # Java
  4974. JAVA_PROTO_PLUGIN(java_plugin apphost/tools/stub_generator/java_plugin DEPS apphost/api/service/java/apphost)
  4975. }
  4976. # tag:internal
  4977. ### Add passed ya.conf.json and all bottle's formula external files to resources
  4978. ### File MUST be arcadia root relative path (without "${ARCADIA_ROOT}/" prefix).
  4979. ### NOTE:
  4980. ### An external formula file referenced from ya.conf.json must be passed as an arcadia root relative path and
  4981. ### should be located in any subdirectory of the ya.conf.json location ("build/" if we consider a production).
  4982. ### The later restriction prevents problems in selectively checkouted arcadia.
  4983. macro YA_CONF_JSON(File) {
  4984. _YA_CONF_JSON($File)
  4985. SET_APPEND(_MAKEFILE_INCLUDE_LIKE_DEPS ${ARCADIA_ROOT}/$File)
  4986. }
  4987. # tag:internal
  4988. # Don't use directly - wrap with custom macros
  4989. macro ADD_LINTER_CHECK(CheckName, Linter, DEPENDS[], EXCLUDE[], FILES[], CONFIGS[]) {
  4990. SET(_FILES_VAR uniq_${hash:VAR_SALT})
  4991. _GLOB($_FILES_VAR $FILES EXCLUDE $EXCLUDE)
  4992. _ADD_LINTER_CHECK($CheckName $Linter ${pre=DEPENDS :DEPENDS} FILES $$_FILES_VAR CONFIGS $CONFIGS)
  4993. }
  4994. # tag:internal
  4995. # Draft. Don't use.
  4996. macro _CPP_STYLE(EXCLUDE[], Files...) {
  4997. ADD_LINTER_CHECK(cpp_style tools/cpp_style_checker/cpp_style_checker DEPENDS contrib/libs/clang12/tools/clang-format EXCLUDE $EXCLUDE FILES $Files CONFIGS devtools/ya/handlers/style/style_config)
  4998. }
  4999. # tag:proto
  5000. macro ALICE_CAPABILITY() {
  5001. CPP_PROTO_PLUGIN(alice_capability_cpp yandex_io/tools/capability_gen .cap.h DEPS yandex_io/libs/protobuf_utils)
  5002. JAVA_PROTO_PLUGIN(alice_capability_java alice/library/go/java_marker_interface_protoc_plugin DEPS alice/protos/endpoint/java_interface alice/megamind/protos/scenarios/java_interface)
  5003. }
  5004. ### @usage: CLANG_EMIT_AST_CXX_RUN_TOOL(Tool Args... [SOURCES ...] [OPTS ...] [IN ...] [IN_NOPARSE ...] [TOOL ...] [OUTPUT_INCLUDES ...] [INDUCED_DEPS ...] [IN_DEPS ...] [STDOUT out-file-name] [STDOUT_NOAUTO out-file-name] [CWD cwd])
  5005. ###
  5006. ### Emit Clang ASTs from .cpp files listed in SOURCES parameter (CXXFLAGS and LLVM_OPTS are passed in, while CFLAGS and C_FLAGS_PLATFORM are not) and run tool Tool with Args... .
  5007. ### OPTS[] parameter is used to pass additional flags to clang. Parameters other than OPTS[] and SOURCES[] are used for runnig a generator (Tool):
  5008. ### - Tool - path to the directory of the tool
  5009. ### - Args... - Tool's arguments
  5010. ### - IN[] - input files required for running the Tool
  5011. ### - IN_NOPARSE[] - input files required for running the Tool, but these files are not parsed for dependencies
  5012. ### - TOOL[] - list of directories of axiliary tools used by Tool
  5013. ### - OUTPUT_INCLUDES[] - includes of the output files which are needed to "build" them
  5014. ### - STDOUT - redirect stdout of the Tool to the output file
  5015. ### - STDOUT_NOAUTO - redirect stdout of the Tool to the output file, but do not chain this file automatically to the processing queue
  5016. ### - CWD - path to the working directory of the Tool
  5017. ### Note: Generated AST files generated into BINDIR according to corresponding .cpp file names listed in SOURCES parameter.
  5018. macro CLANG_EMIT_AST_CXX_RUN_TOOL(SOURCES[], OPTS[], Tool, IN{input}[], IN_NOPARSE{input}[], OUT{output}[], OUT_NOAUTO{output}[], TOOL{tool}[], OUTPUT_INCLUDES[], INDUCED_DEPS[], IN_DEPS[], STDOUT="", STDOUT_NOAUTO="", CWD="", ENV[], Args...) {
  5019. .CMD=${cwd:BINDIR} $YMAKE_PYTHON ${input:"build/scripts/clang_wrapper.py"} $WINDOWS ${CLANG_CPP_COMPILER_BIN} ${pre=-I:_C__INCLUDE} $CXXFLAGS $C_FLAGS_PLATFORM $LLVM_OPTS -emit-ast -c ${input:SOURCES} ${hide;tmp;noext;nopath:SOURCES.ast} $OPTS ${kv;hide:"p ST"} ${kv;hide:"pc light-green"} && ${cwd:CWD} ${env:ENV} ${tool:Tool} $Args ${input;hide:IN} ${input;context=TEXT;hide:IN_NOPARSE} ${input;hide:IN_DEPS} ${output_include;hide:OUTPUT_INCLUDES} $INDUCED_DEPS ${tool;hide:TOOL} ${output;hide:OUT} ${output;noauto;hide:OUT_NOAUTO} ${output;stdout:STDOUT} ${output;stdout;noauto:STDOUT_NOAUTO} ${kv;hide:"p PR"} ${kv;hide:"pc yellow"} ${kv;hide:"show_out"}
  5020. PEERDIR(build/platform/clang)
  5021. }
  5022. @import "${CONF_ROOT}/conf/misc.conf"