?
Solved

GCC Makefile, how to generate lst or lss with c code embedded to lst.

Posted on 2010-11-11
2
Medium Priority
?
2,251 Views
Last Modified: 2013-11-13
Here the attached makefile where I have simple makefile template (part of learning with multiple h and c code)
=========================================================
# ------------- SOURCE FILE ------------------------
OBJECTS = main.o runme.o
#OBJECTS = main.c runme.c
#--------------TARGETS EXE -------------------------
TARGET = go
#--------------Folder Path--------------------------
vpath %.c src
vpath %.h include
vpath %.o obj
# ------------- COMPILER OPTIONS -------------------
CFLAGS=-ggdb -Wall -std=c99 -I include
CC=gcc

# ------------- TARGETS ----------------------------
all: $(TARGET)

$(TARGET): $(OBJECTS)
      $(CC) $(OBJECTS) $(CFLAGS) -o $(TARGET)

# ------------- CLEAN UP ----------------------------
.PHONY: clean
clean:
      rm -f *.o *.out
      
# -------------- DEPENDENCIES ---------------------
runme.o: runme.h
main.o: main.h runme.h
=======================================================

I need to embedded asm with code via lst or lss or s. I do not know how to add option to make it work as I tried several time

(a) what the difference between lst, lss and s
(b) What modification to provides txt files with asm with embedded c code
(c) I need to put .o code into object folder, how

Thanks

I'm using cygwin for training purpose and then work on UNIX (linix server). It use GNU toolchain.


0
Comment
Question by:Richard Payne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
asurianu earned 1500 total points
ID: 34255425
a)  
LST is a dis assembly listing having source code in between. You may not get exact mapping if your compiler has higher optimization
LST assembly listing
.s - is plain assembly code file

b) to generate lst you need to add in your compiler flag rule
-adhlns=$(<:%.c=$(OBJDIR)/%.lst)

c) create a variable say OBJDIR having object directory location and your rule should looks like
$(TARGET): $(OBJECTS)
      $(CC) $(OBJECTS) $(CFLAGS) -o $(OBJDIR)/$(TARGET)


0
 

Author Closing Comment

by:Richard Payne
ID: 34390771
okay
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question