LinuxQuestions.org
Help answer threads with 0 replies.
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 12-21-2005, 05:07 PM   #1
markelo
Member
 
Registered: Mar 2004
Distribution: Red hat 9 -> 64bit fedora
Posts: 190

Rep: Reputation: 30
Producing assembly and object output with GNU make


Second try
http://www.gnu.org/software/make/manual/make.htmlThe manual

Current makefile
Code:
all: $(BINARIES) $(OBJS) $(ASMS)

#Assembly output
%.S: %.cpp 
	$(CXX) -c -S $< $(CXXFLAGS) -o $@

#Compiling
%.o: %.cpp
	$(CXX) -c $^ $(CXXFLAGS)

# linking
test: $(OBJS) $(ASMS)
	$(CXX) $^ -o $@
And explanations

BINARIES has only test.
OBJS have all cpp files but they end with .o
ASMS have all cpp files but they end with .S

And the makefile only produces .o files and executable.
Not the assembly files which I also want. Help appreciated.
 
Old 12-21-2005, 09:48 PM   #2
jbetten
LQ Newbie
 
Registered: Jan 2005
Posts: 19

Rep: Reputation: 0
Nothing obviously stands out, but try...

- removing $(ASM) from the test dependency list.
- removing $(OBJS) from the all dependency list.
- removing -c from the %.S build command.
 
Old 12-22-2005, 03:21 AM   #3
markelo
Member
 
Registered: Mar 2004
Distribution: Red hat 9 -> 64bit fedora
Posts: 190

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by jbetten
Nothing obviously stands out, but try...

- removing $(ASM) from the test dependency list.
- removing $(OBJS) from the all dependency list.
- removing -c from the %.S build command.
Here is my working solution. Thank you from your help.
Code:
all: $(BINARIES) $(ASMS)

#Assembly output
%.s: %.cpp
	@echo myassembly output 
	$(CXX) -S $< $(CXXFLAGS) -o $@

#Compiling 
%.o: %.s $(ASMS)
	@echo myasmcompile
	$(CXX) -c $< $(CXXFLAGS) -o $@

# linking
test: $(OBJS)
	$(CXX) $^ -o $@
There is simpler version but that doesn't produce .o files ( at least they are not left in harddisk ). This version produces .o and .s files.
 
  


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
Which GNU Make???? munichtexan Linux - Newbie 22 11-20-2005 09:37 AM
Specifying the output file for a gnu tool bnj Linux - Newbie 4 06-02-2005 07:52 AM
Java: Encoding a visual object to JPEG (and output to a OutputStream) eantoranz Programming 0 11-16-2004 12:41 PM
PHP not producing output - Apache2 on Gentoo cadsterza Linux - Software 2 09-06-2004 06:18 AM
output file size Linux GNU gcc vs. DJGPP wsimmons Programming 5 01-27-2002 10:20 PM

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

All times are GMT -5. The time now is 01:11 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