+ -
当前位置:首页 → 问答吧 → Mingw studio怎么配置生成汇编文件啊?

Mingw studio怎么配置生成汇编文件啊?

时间:2011-12-06

来源:互联网

1. 怎么配置Mingw studio能生成汇编文件啊?

2. 或者怎么修改下面的makefile,用MingW-make.exe生成汇编文件啊?

#################################################################
## This Makefile Exported by MinGW Developer Studio
## Copyright (c) 2002-2004 by Parinya Thipchart
#################################################################

ifneq (,$(findstring Release, $(CFG)))
  override CFG = Release
else
  override CFG = Debug
endif

PROJECT = 1
CC = "C:\MinGWStudio\MinGW\bin\gcc.exe"

ifeq ($(CFG),Debug)
  OBJ_DIR = Debug
  OUTPUT_DIR = Debug
  TARGET = 1.exe
  C_INCLUDE_DIRS = 
  C_PREPROC = 
  CFLAGS = -pipe -Wall -g2 -O0 
  RC_INCLUDE_DIRS = 
  RC_PREPROC = 
  RCFLAGS = 
  LIB_DIRS = 
  LIBS = 
  LDFLAGS = -pipe 
endif

ifeq ($(CFG),Release)
  OBJ_DIR = Release
  OUTPUT_DIR = Release
  TARGET = 1.exe
  C_INCLUDE_DIRS = 
  C_PREPROC = 
  CFLAGS = -pipe -Wall -g0 -O2 
  RC_INCLUDE_DIRS = 
  RC_PREPROC = 
  RCFLAGS = 
  LIB_DIRS = 
  LIBS = 
  LDFLAGS = -pipe -s 
endif

ifeq ($(OS),Windows_NT)
  NULL =
else
  NULL = nul
endif

SRC_OBJS = \
  $(OBJ_DIR)/main.o

define build_target
@echo Linking...
@$(CC) -o "$(OUTPUT_DIR)\$(TARGET)" $(SRC_OBJS) $(LIB_DIRS) $(LIBS) $(LDFLAGS)
endef

define compile_source
@echo Compiling $<
@$(CC) $(CFLAGS) $(C_PREPROC) $(C_INCLUDE_DIRS) -c "$<" -o "$@"
endef

.PHONY: print_header directories

$(TARGET): print_header directories $(SRC_OBJS)
$(build_target)

.PHONY: clean cleanall

cleanall:
@echo Deleting intermediate files for '1 - $(CFG)'
-@del $(OBJ_DIR)\*.o
-@del "$(OUTPUT_DIR)\$(TARGET)"
-@rmdir "$(OUTPUT_DIR)"

clean:
@echo Deleting intermediate files for '1 - $(CFG)'
-@del $(OBJ_DIR)\*.o

print_header:
@echo ----------Configuration: 1 - $(CFG)----------

directories:
-@if not exist "$(OUTPUT_DIR)\$(NULL)" mkdir "$(OUTPUT_DIR)"
-@if not exist "$(OBJ_DIR)\$(NULL)" mkdir "$(OBJ_DIR)"

$(OBJ_DIR)/main.o: main.c

$(compile_source)

作者: Start13   发布时间: 2011-12-06

gcc 只要加 -S参数就可以生成与.c或.cpp同名的.s汇编程序,但它是AT&T格式的
上面的make文件

LDFLAGS = -pipe -s 

LDFLAGS = -pipe -s -S
就应该可以了

作者: keiy   发布时间: 2011-12-06