From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.help Subject: Re: Running makefiles from emacs Date: Thu, 01 Jul 2021 20:18:50 +0200 Message-ID: References: <87tulibyap.fsf@zoho.eu> <87pmw6oc1z.fsf@cock.li> <87k0md9cxb.fsf@zoho.eu> <87h7hggafy.fsf@cock.li> <874kdf6uo7.fsf@zoho.eu> <87bl7nf7tx.fsf@cock.li> <878s2qfja9.fsf@cock.li> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12408"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: help-gnu-emacs@gnu.org, Emanuel Berg To: mrf Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 01 20:19:30 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lz1Hc-000354-3T for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 01 Jul 2021 20:19:28 +0200 Original-Received: from localhost ([::1]:53126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lz1Hb-0004m1-2J for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 01 Jul 2021 14:19:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lz1HB-0004lb-5w for help-gnu-emacs@gnu.org; Thu, 01 Jul 2021 14:19:01 -0400 Original-Received: from mail-vi1eur05olkn2030.outbound.protection.outlook.com ([40.92.90.30]:5088 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lz1H6-0003lw-VM for help-gnu-emacs@gnu.org; Thu, 01 Jul 2021 14:19:00 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PXnXU93DzfxKt75S05lU8dy+lMx6yRTmzXMXdqHv3IZBGqDkGG3NOojad2raytE8IVebALXoRxFNOc2wKXZ2or4VhStn21Ic0p9yZ5KHHBOoHzekrIMOT5PVlyybR+DU2XKJ8U3LnZYGbZ+FaY+L05pQn6SEYwQk7x49txwdUGx5Hca86eV8Heo2hchU6nVGcHhTnCI6eheUSp6VG1UUvpmpzL4Q24dvSA7LYc1mD3WwyWJc1T7AQHsn3WUIwQyqySRIMxcCKrjDeGnv9wVvDIqmDKUSO4qBxT9ZrLTIGe4pTRpD5G3Loj+tqydV+cBICncCv6E3T44belVb7wcjkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/b2W2YtpaZcaKjgPNMqQ62YVLzXSHFJNCuqIg6OFm4k=; b=n7fjVvBSEqUBmNRfyA2tzO1XjcE0OcMKvfNQ2JMcFoWV5diuIEg4bYMoNxXt0pElfj74h5cZFe3JU8xeupdqfmEg9aUzxekWr/bh6xbGckfU6V04q8BwWwHm5FwabDlv9jAgGJR72MwPSaDKyDNA898IZG0dJX2Ym0VGROh0pmjOzttsekfVkrhzS4hMRi3PHHUQuB/9wg8JdOJMZOZEDgzxx0c+AP3JdIbEJufhmr+dyFCK4mjjzZuLUTLX5KKLPKOM/Eg32IqgyULyvXCstzzIfUP+WFHHjIVhFcdca+Cnsaektn98ZGltvon+ovDEaLnjtZ4NLjG3hZjOVy+rjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/b2W2YtpaZcaKjgPNMqQ62YVLzXSHFJNCuqIg6OFm4k=; b=oZQrJ64wVKam6b5/+BwifZG1MgRw8lQ/E2PCQ06YQUGFUHrwwCQXE/r7PjSixa5pFM0SzgxXRLuuM+iA5baB4Ewo6cxSKIiIaYGPiaTnVaPETkSLnTQPOKaXV/sT7odh1Y3sgM1yeZX+bQMPmSp2GXiJnc3kQqiV19HhcDcWCPjNii5LFWk/K9tWxiGR8AuSJg9H2JH8OBKc6jeiX4tla39YuGKqq6uW6iOjcshZlZoFqqZcCOMkERilgS3e+elec4YvsSdbj8mkbqAzelf4PuJEedzQQaAM9x/YvEjdlTYA0C4WRl1j21HlLbHpmLV5f9FEuEJ+98Iv/vwOcPZEog== Original-Received: from VI1EUR05FT025.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc12::4e) by VI1EUR05HT067.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc12::194) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.22; Thu, 1 Jul 2021 18:18:51 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2a01:111:e400:fc12::44) by VI1EUR05FT025.mail.protection.outlook.com (2a01:111:e400:fc12::123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.22 via Frontend Transport; Thu, 1 Jul 2021 18:18:51 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:A41AEC75B21BB07DA5C5EC587D7E302C97B11F3D511F47520C0BB0798A12DECB; UpperCasedChecksum:E048D9DD6FDBA5B6371262F2B3D007E8A8F203E2AAB756920D918E4067233F16; SizeAsReceived:7665; Count:46 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::656a:1596:f5dc:12ea]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::656a:1596:f5dc:12ea%7]) with mapi id 15.20.4287.023; Thu, 1 Jul 2021 18:18:51 +0000 In-Reply-To: <878s2qfja9.fsf@cock.li> (mrf's message of "Thu, 01 Jul 2021 12:33:48 +0300") X-TMN: [jChZFG/wzuOzLcZHVg27wPEeuC9Pbo9Y] X-ClientProxiedBy: AM5PR0601CA0056.eurprd06.prod.outlook.com (2603:10a6:206::21) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87lf6p7v91.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by AM5PR0601CA0056.eurprd06.prod.outlook.com (2603:10a6:206::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.20 via Frontend Transport; Thu, 1 Jul 2021 18:18:50 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 26b36ecf-76e5-44d7-0793-08d93cbcad4a X-MS-TrafficTypeDiagnostic: VI1EUR05HT067: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4PwIr80tZPkulkP19W4iNRJnWM6iyCrKXUHTn3qGDgxX7FBECWmTf9n2GCp1fh+qWcNmAslqi9mC2gKXSRATvV2KFzM9omOAUVTMLgJItT0OS8fVyX2jWfrH3I+EU8b+v4pzuVudQFpg57ThtBjDWoDyj1Nn7bl2xCQRXCOuvyxf8Q3Iq5+/9CNvE/QQUz2O21XPZzW83UPGy5BR+phkFSJC3e5s1ttFvXJEIsgfBHu62b/bXCMTMV8NK/CNObB/0gYnds1TVabrSBRWzPSVqhFxwFwPbxFyvmFkArkxr5IqMHCeHHE2TED7O41RdC6npqe+LIZP6rHzyyHKzYvvuU32GrmqHyjrdD4sEIsbzS05YQ0dQNq00aX0KXS3Rfrx26UeAWqx+tiaAFlp9Vkt2b1qDIPQbYNDekJwLOZWjNWHKDzAG6pu5sxqxNjzNsdgilnky8luDPYQ/YTAo5bBC9QfkmS8pYnA/VZ1DiIK5VLgxQGcn6hH84SwR5lEaKqTpQuso6XP40gCj8sY8AhTZw== X-MS-Exchange-AntiSpam-MessageData: euaXdiKDaez2Wzgh0xO6l+bdAMgDzrZJ3Mv0PV+49eUi4AxJReSM0hDA7yLiTzEFNpP2Q/1IsgD5FcIJjmeSe62cecELMzK26hMArfS8LCIZGBhiAM3G28J1lBa+VlCRPPzcOTUs6rV/YihEWrps8A== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: 26b36ecf-76e5-44d7-0793-08d93cbcad4a X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2021 18:18:51.2177 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: VI1EUR05FT025.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1EUR05HT067 Received-SPF: pass client-ip=40.92.90.30; envelope-from=arthur.miller@live.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:131367 Archived-At: mrf writes: > Arthur Miller writes: > >> Emacs comment is neat. You can achieve similar with a small shell script >> too, check this: >> >> https://github.com/ryanmjacobs/c > > I love this community it's nice place to share nice hacks > > But I have something surpasses this and I don't use it in my article > because it's too old, anyway take this: > > /*****************/ > /* script.c file */ > /*****************/ > #if 0 > #//if file is not yet compiled > if [ -f $(basename $0 .c) ] > then > printf "" > else > gcc $CFLAGS $CXXFLAGS $LDFLAGS $0 -o `basename $0 .c` && exec ./`basename $0 .c` "$@"; > fi; > > #//if file is already compiled > if [ `stat -c %Y $(basename $0 .c) ` -lt `stat -c %Y $0` ] > then > gcc $CFLAGS $CXXFLAGS $LDFLAGS $0 -o `basename $0 .c` && exec ./`basename $0 .c` "$@"; > else > exec ./`basename $0 .c` "$@"; > fi; > exit > #endif // 0 > > #include > #include > > int main (int argc, char **argv) > { > printf("%f\n", cosf (103.0f)); > > printf( > "variables in argv (excluding %s) =%d\nparam1=%s param2=%d param3=%d\n\n", > __FILE__, argc-1, argv[1], atoi(argv[2]), atoi(argv[3])); > > return 0; > } > > /* Local Variables: */ > /* compile-command: "LDFLAGS='-lm' CFLAGS='-Wall' bash script.c 'String' 10 5395" */ > /* End: */ > > > > > this neat hack will include a full fledged bash script and this script > will only compile when file is changed otherwise will run the program, > you can run it with: > > bash script_name.c > > or by changing the file permission `chmod +x script_name.c` and then > `./script_name.c` > > the idea is that there is conditional preprocessor that will only > compile when true(1) and we set it to false(0) on purpose. > > Also this script allow you to pass paramenters and also compiler flags > by using environment variable and I think this is great way to write C > CGI scripts. > > And BTW tiny C compiler is better option than what you send. Yes, TCC comes with a similar hack, but the C script is independent of the compiler and you don't need to clutter each and every file with bash script and linker/compiler directives in each file either. But sure, there is more than one way to skin a cat .... no idea why people say that, I assure I have never try to skinn a cat nor any other animal.