ymake.core.conf 234 KB

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