ymake.core.conf 251 KB

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