Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2010-11-11
2
Medium Priority
?
2,302 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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?
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Introduction to Processes

618 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