ymake.core.conf 251 KB

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