Solved

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

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
Scripting vs. Programming languages 25 179
Please explain: Aspect Oriented Programming 2 101
simplest php form 3 81
Query Syntax 17 43
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
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?
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 …

839 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