LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-06-2024, 12:13 AM   #16
ajiten
Member
 
Registered: Jun 2023
Posts: 375

Original Poster
Rep: Reputation: 4

Quote:
Originally Posted by pan64 View Post
removed
Please elaborate.
 
Old 02-06-2024, 12:21 AM   #17
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,266
Blog Entries: 24

Rep: Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195
Quote:
Originally Posted by ajiten View Post
Request a tool that helps find the (matching) ending parenthesis, as don't think vim helps in that.
How so? As stated, good old Vim does exactly that, in multiple ways.

Place the cursor onto any of {([])} (or preprocessor conditional in C/C++ code). Type %.

What happens? (In your own words, please, no screenshots)

Double-click on any of {([])}.

What happens? (ditto)

There are other ways in Vim, see if you can find them.

Quote:
Originally Posted by ajiten View Post
Even VS seems to not help, as easily got confused by that...
Even. Not surprised.
 
2 members found this post helpful.
Old 02-06-2024, 12:27 AM   #18
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,855

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
Quote:
Originally Posted by ajiten View Post
Please elaborate.
I made a wrong post, removed and later also posted something more useful. That's all. Forget it.
 
2 members found this post helpful.
Old 02-06-2024, 12:55 AM   #19
ajiten
Member
 
Registered: Jun 2023
Posts: 375

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by astrogeek View Post
How so? As stated, good old Vim does exactly that, in multiple ways.

Place the cursor onto any of {([])} (or preprocessor conditional in C/C++ code). Type %.

What happens? (In your own words, please, no screenshots)

Double-click on any of {([])}.

What happens? (ditto)

There are other ways in Vim, see if you can find them.



Even. Not surprised.
Yes, it is working both in WSL ubuntu (on Windows), and Cygwin. The reason it worked now that only now pressed '%' in conjunction with the Shift key.
Sorry, but in haste forgot which is the correct key to press, along with the '%' key.
Very sorry, but still the question asked in post #6 (by me), for implementing the idea of @gstavi remains. Though I know (by reading books on 'make') that it is based on advanced syntax used in the makefiles.
Attached Thumbnails
Click image for larger version

Name:	Screenshot (263).png
Views:	7
Size:	176.5 KB
ID:	42524  

Last edited by ajiten; 02-06-2024 at 12:57 AM.
 
Old 02-06-2024, 01:01 AM   #20
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,855

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
Quote:
Originally Posted by ajiten View Post
Yes, it is working both in WSL ubuntu (on Windows), and Cygwin. The reason it worked now that only now pressed '%' in conjunction with the Shift key.
Sorry, but in haste forgot which is the correct key to press, along with the '%' key.
So finally it started to work. Good news.
Quote:
Originally Posted by ajiten View Post
Very sorry, but still the question asked in post #6 (by me), for implementing the idea of @gstavi remains. Though I know (by reading books on 'make') that it is based on advanced syntax used in the makefiles.
I don't understand what is it all about. Do you want to implement something?
 
Old 02-06-2024, 01:03 AM   #21
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,865
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
@OP Again, what is the actual goal, what do you wish to achieve with this? Say, you succeed to get two line-numbere, what will you do with them?
 
Old 02-06-2024, 01:14 AM   #22
ajiten
Member
 
Registered: Jun 2023
Posts: 375

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by NevemTeve View Post
@OP Again, what is the actual goal, what do you wish to achieve with this? Say, you succeed to get two line-numbere, what will you do with them?
At least it is an exercise, that makes me interesting to work in area that uses the advanced syntax of the makefile, though introduced by you, in modification of a stackexchange site's question's code.
I have seen the syntax and the capabilities of the makefile, in book(s); and feel they are using CFG, in order to implement the concise syntax.

That is interesting, but for the start point, the solution proposed by @gstavi, was nice.

Last edited by ajiten; 02-06-2024 at 01:18 AM.
 
Old 02-06-2024, 01:20 AM   #23
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,865
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
A random idea: perhaps you could read the documentation instead of the source:
https://www.gnu.org/software/make/manual/make.html
 
1 members found this post helpful.
Old 02-07-2024, 01:38 AM   #24
ajiten
Member
 
Registered: Jun 2023
Posts: 375

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by NevemTeve View Post
A random idea: perhaps you could read the documentation instead of the source:
https://www.gnu.org/software/make/manual/make.html
The section 2.3 states:
Code:
2.3 How make Processes a Makefile
By default, make starts with the first target (not targets whose names start with ‘.’ unless they also contain one or more ‘/’).
which is not made clear at all; though at the end of section 2.5, it states
Code:
.PHONY : clean
Am not clear at all of the meaning of '/'.

Also, I assume that the usual '\' in the given makefiles, implies a newline character, as it occurs at the end of any given line. If it is an explicit '\', then please confirm, along with the reason for such a syntax.

Left are only the doubts for formatting using tab, but would ask later, as lesser important. The issue there is minimal, and need to see the code too in the line #570 till line #1359, as stated earlier in post #4, by @astrogeek.

-------------

P.S. : Please tell if in the code given here (as provided by @pan64, in post #2), have the implementation for the syntax implementation of the makefile, as given in the section 2.6; i.e.
Code:
objects = main.o kbd.o command.o display.o \
          insert.o search.o files.o utils.o

edit : $(objects)
        cc -o edit $(objects)

$(objects) : defs.h
kbd.o command.o files.o : command.h
display.o insert.o search.o files.o : buffer.h

Last edited by ajiten; 02-07-2024 at 01:56 AM.
 
Old 02-07-2024, 02:00 AM   #25
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,855

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
/ is simply the directory separator. In makefiles the targets are usually files, if the target contains a / it means it is located somewhere else, not in the current directory. Otherwise you can safely ignore it for now. Do not mix / and \ , these are two different things.
 
1 members found this post helpful.
Old 02-07-2024, 03:21 AM   #26
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,865
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Backslash at end of line is the continuation symbol.
Code:
.PHONY: cheers

cheers:
        echo "Hi\
        there"
Result:
Code:
$ make cheers
echo "Hi\
there"
Hithere
$ make --silent cheers
Hithere
Two answer your next questions:
* .PHONY means: this target doesn't actually create a file
* --silent means: don't print the commands before executing them
 
Old 02-07-2024, 03:30 AM   #27
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,865
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Sample in #24:
Code:
objects = main.o kbd.o command.o display.o \
          insert.o search.o files.o utils.o
It is a variable-assignment

Code:
edit : $(objects)
        cc -o edit $(objects)
This is a complete rule.

Code:
$(objects) : defs.h
kbd.o command.o files.o : command.h
display.o insert.o search.o files.o : buffer.h
These are dependencies without commands. Of course $(objects) will be resolved into its content:
Code:
main.o kbd.o command.o display.o insert.o search.o files.o utils.o: defs.h
meaning: these objects all depend on defs.h
 
Old 02-07-2024, 04:04 AM   #28
ajiten
Member
 
Registered: Jun 2023
Posts: 375

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by NevemTeve View Post
Sample in #24:
Code:
objects = main.o kbd.o command.o display.o \
          insert.o search.o files.o utils.o
It is a variable-assignment

Code:
edit : $(objects)
        cc -o edit $(objects)
This is a complete rule.

Code:
$(objects) : defs.h
kbd.o command.o files.o : command.h
display.o insert.o search.o files.o : buffer.h
These are dependencies without commands. Of course $(objects) will be resolved into its content:
Code:
main.o kbd.o command.o display.o insert.o search.o files.o utils.o: defs.h
meaning: these objects all depend on defs.h
Thanks, but regarding the last part of your kind response, I request(ed) the implementation code too.
 
Old 02-07-2024, 04:07 AM   #29
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,855

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
Quote:
Originally Posted by ajiten View Post
Thanks, but regarding the last part of your kind response, I request(ed) the implementation code too.
Implementation of what?
I sent you the source of make, you can browse the whole repo to find anything you are interested in.
 
Old 02-07-2024, 04:34 AM   #30
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,865
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
@OP It is commendable that you manage to create such incomprehensible sentences, but let's assume that your asking about rules that don't have recipe part. Of course these are just dependencies, the recipe comes from somewhere else. This might be an implicit rule. Sample:
Code:
CFLAGS  = -m64 -g -W
LDFLAGS = -m64 -g

main: foo.h
main: main.c
        ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o $@ $< ${LDLIBS}
When you enter `make main`, make will execute this:
Code:
cc -m64 -g -W  -m64 -g -o main main.c
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Handling space in lexer. ajiten Programming 5 11-28-2023 07:46 AM
Does lexer tool need be coded in the same language, as the source language? ajiten Programming 12 07-09-2023 11:18 PM
Where to post lexer file related issues. ajiten Programming 5 07-04-2023 02:06 AM
list all contains and subdirectories' contains babis Linux - Newbie 2 10-22-2004 09:40 PM
Command to find out which package contains which file ? javeree Slackware 6 07-10-2004 06:35 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration