[Ô­´´] Scons ѧϰ֮һ

lugl4313820   2023-4-20 09:28 Â¥Ö÷

ÔںõĻúÆ÷ÉÏÓÃMDK±àÒ빤³Ì£¬¸Ð¾õ»¹ºÃ£¬µ«ÊÇÔÚÎÒµÄÀϵçÄÔÉÏÓÃMDK±àÒ룬ÄÇÊÇÕæµÄÄѵȡ£ÓÃÁËScons+VScodeÖ®ºó£¬¸Ð¾õÕ⹤¾ßÄÇÊÇÏ൱µÄºÃÓᣵ«ÊÇÓõŤ¾ßÊÇÈ˼ÒдºÃµÄ£¬ÕâÀï×¼±¸Ñ§Ï°Scons¡£

 

SconsÊÇmakeµÄÉý¼¶²úÆ·£¬Ëü×öµÄÊÂÇé¸úmakeÒ»Ñù£¬µ«¸ü¼òµ¥£¬¸üÈÝÒס£

SconsÊÇÒ»¸ö¿ª·ÅÔ´Â룬ÒÔPythonÓïÑÔ±àÂëµÄ×Ô¶¯»¯¹¹½¨¹¤¾ß£¬¿ÉÓÃÀ´Ìæ´úmake±àд¸´ÔÓµÄmakefile¡£²¢ÇÒsconsÊÇ¿çƽ̨µÄ£¬Ö»Òªscons½Å±¾Ð´µÄºÃ£¬¿ÉÒÔÔÚlinuxºÍWindowsÒÔ¼°macosÏÂËæÒâ±àÒë¡£

SconsµÄÉè¼ÆÄ¿µÄ¾ÍÊÇÈÿª·¢ÈËÔ±¸üÈÝÒ×£¬¸ü¿É¿¿ºÍ¸ü¿ìËٵĽ¨ÔìÈí¼þ¡£

Ó봫ͳµÄmake¹¤¾ß±È½Ï£¬SCons¾ßÓÐÒÔÏÂÓŵ㣺

  • ʹÓÃPython½Å±¾×öΪÅäÖÃÎļþ
  • ¶ÔÓÚC£¬C++ºÍFortran£¬ÄÚ½¨Ö§³Ö¿É¿¿×Ô¶¯ÒÀÀµ·ÖÎö£¬²»ÓÃÏñmake¹¤¾ßÄÇÑùÐèÒªÖ´ÐГmake depends“ºÍ“make clean”¾Í¿ÉÒÔ»ñµÃËùÓеÄÒÀÀµ¹Øϵ¡£
  • ÄÚ½¨Ö§³ÖC£¬C++£¬D£¬Java£¬Fortran£¬Yacc£¬Lex£¬Qt£¬SWIGÒÔ¼°Tex/Latex¡£Óû§»¹¿ÉÒÔ¸ù¾Ý×Ô¼ºµÄÐèÒª½øÐÐÀ©Õ¹ÒÔ»ñµÃ¶ÔÐèÒª±à³ÌÓïÑÔµÄÖ§³Ö¡£
  • Ö§³Ömake -j ·ç¸ñµÄ²¢Ðн¨Ôì¡£Ïà±Èmake -j ,SCons¿ÉÒÔͬʱÔËÐÐN¸ö¹¤×÷£¬¶ø²»Óõ£ÐÄ´úÂëµÄ²ã´Î½á¹¹¡£
  • ʹÓÃAutoconf·ç¸ñ²éÕÒÍ·¼þ£¬º¯Êý¿â£¬º¯ÊýºÍÀàÐͶ¨Òå¡£
  • Á¼ºÃµÄ¿çƽ̨ÐÔ¡£SCons¿ÉÒÔÔËÐÐÔÚLinux£¬AIX£¬BSD£¬HP/UX£¬IRIX£¬Solaris£¬Windows£¬Mac OS XºÍ OX/2ÉÏ¡£

 

»Ø¸´ÆÀÂÛ £¨16£©

SconsʹÓÃ

°²×°

ÔÚSConsµÄ¹Ù·½ÍøÕ¾ÉÏ¿ÉÒԲ鵽ÿ¸öƽ̨µÄ¾ßÌå°²×°·½·¨¡£

Winƽ̨ϵÄÏÂÔغͰ²×°£¬¿ÉÒÔһ·NEXT¡£

LinuxÏÂÏÂÔØtar°ü£¬Ö´ÐÐÒÔÏÂÃüÁî¼´¿É£º

tar -zxf scons-2.0.1.tar.gz
cd scons-2.0.1
sudo python3 setup.py install

¶ÔÓÚLinuxÀ´Ëµ£¬scons»áĬÈÏ°²×°µ½/usr/local/binĿ¼Ï£¬¶øÔÚWindowsƽ̨ÉÏ£¬Ôò»á±»°²×°µ½Python3\ScriptĿ¼Ï¡£

µãÔÞ  2023-4-20 09:37

ʹÓÃ

ÕâÀïͨ¹ýÒ»¸ö¼òµ¥µÄʾÀýÀ´ËµÃ÷¡£

Ò»¸öhello.cÔ´Îļþ£¬Ò»¸öSConsturctÎļþ

hello.c:

#include <stdio.h>

int main(void)
{
        printf("hello,scons!\n");

        return 0;

}

SConstruct

Program("hello.c")

ÔËÐÐScons,µÃµ½½á¹ûÈçÏ£º

liujianhuadeiMac:myscons liujianhua$ cat SConstruct 
Program("hello.c")
liujianhuadeiMac:myscons liujianhua$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o hello.o -c hello.c
gcc -o hello hello.o
scons: done building targets.
liujianhuadeiMac:myscons liujianhua$ ./hello 
hello,scons!
liujianhuadeiMac:myscons liujianhua$ ls
SConstruct	hello		hello.c		hello.o
liujianhuadeiMac:myscons liujianhua$ 

ÔÚÉÏÃæµÄÔËÐнá¹ûÀïÃæÎÒÃÇ¿´µ½£¬³ÌÐòµÄ±àÒëÓëmakeûÓÐʲôÁ½Ñù£¬Í¬ÑùµÄ²Ù×÷£¬Ö»ÊÇ°Ñscons»»³Émake£¬SConstruct»»³ÉMakefile¡£SconsÏà±ÈMakefile¼òµ¥ºÜ¶à¡£

SconstructÒÔPython½Å±¾µÄÓï·¨±àд£¬Äã¿ÉÒÔÏñ±àдPython¶Ç×Ó±¾Ò»ÑùÀ´±àдËû¡£ÆäÖеÄProgramÊDZàÒëµÄÀàŪ£¬ËµÃ÷Äã×¼±¸Ï뽨һ¸ö¿ÉÖ´ÐеĶþ½øÖƳÌÐò£¬ËüÓÉhello.cÎļþÀ´Éú³É¡£

ÔÚÕâÀûÓÐÖ¸¶¨Éú³ÉµÄ¿ÉÀ©ÐгÌÐòµÄÃû×Ö£¬SCons»á°ÑÔ´´úÂëÎļþÃû×ֵĺó׺ȥµô£¬ÓÃÀ´×÷Ϊ¿ÉÖ´ÐÐÎļþµÄÃû×Ö¡£

ÎÒÃÇÉõÖÁ²»ÐèÒªÏñMakefileÄÇÑùÖ¸¶¨ÇåÀíµÄ¶¯×÷£¬¾Í¿ÉÒÔÀ©ÐÐÇåÀíÈÎÎñ¡£ÔÚSConsÖУ¬Ö´ÐÐÇåÀíÈÎÎñÓɲÎÊý-cÖ¸¶¨£¬ÈçÏ£º

liujianhuadeiMac:myscons liujianhua$ scons -c
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Cleaning targets ...
Removed hello.o
Removed hello
scons: done cleaning targets.
liujianhuadeiMac:myscons liujianhua$ ls
SConstruct	hello.c
liujianhuadeiMac:myscons liujianhua$ 

 

µãÔÞ  2023-4-20 09:54

ºÃ¶«Î÷¡£Â¥Ö÷ÓúÃÁ˶à½éÉܽéÉÜ¡£

µãÔÞ  2023-4-20 10:00
ÒýÓÃ: damiaa ·¢±íÓÚ 2023-4-20 10:00 ºÃ¶«Î÷¡£Â¥Ö÷ÓúÃÁ˶à½éÉܽéÉÜ¡£

¶àл¹Ø×¢£¬ÕýÔÚŬÁ¦Ñ§Ï°ÖУ¬ÕùÈ¡ÒÔºó±à¼­Æ÷Óë±àÒëÆ÷·ÖÀ룬ÕâÑù×ÔÓɶȾͺã¬ÏÖÔÚÕû¸ö±àÒë»·¾³ÄÇÊÇÏ൱µÄÀÛ¡£

µãÔÞ  2023-4-20 10:33

¸Ð¾õÌ«Âé·³ÁË£¬¼òµ¥µÄÏîÄ¿Åú´¦Àíµ÷ÓþÍÐÐÁË¡£

µãÔÞ  2023-4-20 14:30

scons¹¤¾ßÊÇרÃÅΪC¹¤³ÌÉè¼ÆµÄ±àÒ빤¾ß°É£¿

µãÔÞ  2023-4-20 14:33

VScodeͦºÃÓõģ¬Õâ¸öÈí¼þÏà¶ÔÀ´ËµÐ¡ºÜ¶à      

ÔÚ°®ºÃµÄµÀ·Éϲ»¶ÏÇ°½ø£¬ÔÚÉú»îµÄÃÔÎíÖв¥Èö¹âÒý
µãÔÞ  2023-4-20 15:11
ÒýÓÃ: fxyc87 ·¢±íÓÚ 2023-4-20 14:30 ¸Ð¾õÌ«Âé·³ÁË£¬¼òµ¥µÄÏîÄ¿Åú´¦Àíµ÷ÓþÍÐÐÁË¡£

ÎҸоõÕâ¸öͦºÃµÄ£¬ÌرðÊÇ´¦Àí´ó¹¤³Ìʱ¡£

µãÔÞ  2023-4-20 15:41
ÒýÓÃ: wangerxian ·¢±íÓÚ 2023-4-20 14:33 scons¹¤¾ßÊÇרÃÅΪC¹¤³ÌÉè¼ÆµÄ±àÒ빤¾ß°É£¿

C++Ò²Ö§³Ö°É£¬¿ÉÒÔÓõķ¶Î§ºÜ¶à¡£

µãÔÞ  2023-4-20 15:42
ÒýÓÃ: ÇØÌìqintian0303 ·¢±íÓÚ 2023-4-20 15:11 VScodeͦºÃÓõģ¬Õâ¸öÈí¼þÏà¶ÔÀ´ËµÐ¡ºÜ¶à      

vscode+scons,ÄDzÅÊǾøÅä°É¡£

µãÔÞ  2023-4-20 15:42
ÒýÓÃ: lugl4313820 ·¢±íÓÚ 2023-4-20 15:42 C++Ò²Ö§³Ö°É£¬¿ÉÒÔÓõķ¶Î§ºÜ¶à¡£

¶Ô£¬C++/C±àÒ빤¾ß£¬±Ï¾¹ÊÇÒ»¼ÒÈË¡£

µãÔÞ  2023-4-20 16:30

SConsÌýºÃµÄ£¬¿ÉÒÔÔÚ¶à¸öƽ̨ÉÏÔËÐУ¬°üÀ¨Windows¡¢Linux¡¢Mac OSµÈ¡£

µãÔÞ  2023-4-20 22:40
ÒýÓÃ: lugl4313820 ·¢±íÓÚ 2023-4-20 15:42 vscode+scons,ÄDzÅÊǾøÅä°É¡£

scons¶¼Ö§³Öʲô±àÒë°¡£¿    

ÔÚ°®ºÃµÄµÀ·Éϲ»¶ÏÇ°½ø£¬ÔÚÉú»îµÄÃÔÎíÖв¥Èö¹âÒý
µãÔÞ  2023-4-21 08:39
ÒýÓÃ: ÇØÌìqintian0303 ·¢±íÓÚ 2023-4-21 08:39 scons¶¼Ö§³Öʲô±àÒë°¡£¿    

make ÄÜÖ§³ÖµÄËü¶¼ÄÜÖ§³Ö£¬Ëû¾ÍÊÇÓÃpythonдÁËÒ»¸ö½Å±¾£¬È¥µ÷ÓÃmake£¬±È½ÏÖÇÄÜһЩ¡£

µãÔÞ  2023-4-21 08:48

SconsÓõÄÈ˲»¶à°É£¬Ïà±È½ÏÏÖÔÚ»¹ÊÇcmakeÖ÷Á÷һЩ¡£

ĬÈÏÃþÓ㣬ÔÙÃþÓã¡£2022¡¢9¡¢28
µãÔÞ  2023-4-28 15:40
ÒýÓÃ: freebsder ·¢±íÓÚ 2023-4-28 15:40 SconsÓõÄÈ˲»¶à°É£¬Ïà±È½ÏÏÖÔÚ»¹ÊÇcmakeÖ÷Á÷һЩ¡£

RT-ThreadÊÇÓÃÕâ¸ö¡£×î½üѧϰrtthread,ËùÒÔѧϰһÏ£¬Ïà±ÈcmakeÒª¼òµ¥Ò»Ð©¡£

µãÔÞ  2023-4-28 16:37
µç×Ó¹¤³ÌÊÀ½ç°æȨËùÓÐ ¾©B2-20211791 ¾©ICP±¸10001474ºÅ-1 ¾©¹«Íø°²±¸ 11010802033920ºÅ
    д»Ø¸´