Solved

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

Posted on 2010-11-11
2
2,132 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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is about my first experience with programming Arduino.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
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…

730 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