【发布时间】:2016-06-13 23:37:26
【问题描述】:
正如主题所述 - 在 Eclipse C/C++ 中自动生成的 makefile 只编译一个模块......我有一个 C/C++ 中的 Eclipse 项目,它使用 MinGW (gcc) 编译。现在我想用 makefile 让它可以从命令行构建。所以我检查了 makefiles(Makefile, objects.mk, sources.mk and all subdir.mk-s) 是否获得。问题是,当我在正确的目录(包含 Makefile)中键入并运行 make 时,它只编译一个文件,在这种特殊情况下为 des.c(它提供一个目标文件 des.o)并且退出时没有任何我不知道的错误为什么。虽然从 eclipse 构建成功地提供了一个可执行文件作为人工制品。
为这个问题的一堆附件道歉 - 尽管我认为这都是相关的。
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
-include ../makefile.init
RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include sim/xyssl/subdir.mk
-include sim/subdir.mk
-include hal_i386/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(CC_DEPS)),)
-include $(CC_DEPS)
endif
ifneq ($(strip $(C++_DEPS)),)
-include $(C++_DEPS)
endif
ifneq ($(strip $(C_UPPER_DEPS)),)
-include $(C_UPPER_DEPS)
endif
ifneq ($(strip $(CXX_DEPS)),)
-include $(CXX_DEPS)
endif
ifneq ($(strip $(CPP_DEPS)),)
-include $(CPP_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif
-include ../makefile.defs
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: my_sim_card.exe
# Tool invocations
my_sim_card.exe: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: MinGW C++ Linker'
g++ -o "my_sim_card.exe" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
# Other Targets
clean:
-$(RM) $(CC_DEPS)$(C++_DEPS)$(EXECUTABLES)$(OBJS)$(C_UPPER_DEPS)$(CXX_DEPS)$(CPP_DEPS)$(C_DEPS) my_sim_card.exe
-@echo ' '
.PHONY: all clean dependents
.SECONDARY:
-include ../makefile.targets
我也尝试过注释 subdir 的第一个包含(即包含 sim/xyssl/subdir.mk),在这种情况下它只编译 STK_application.c 就像这里
也许这与问题原因有关 - 我已将文件/文件夹安装为外部文件(工作区目录之外的上层文件夹),但是 - 再次 - 它在 Eclipse 中工作正常。另外我想说的是,无论选项Expand Env. Variable Refs in Makefile 启用还是禁用,它的行为都是相同的。
其他文件如下所示:
来源.mk
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
C_UPPER_SRCS :=
CXX_SRCS :=
C++_SRCS :=
OBJ_SRCS :=
CC_SRCS :=
ASM_SRCS :=
CPP_SRCS :=
C_SRCS :=
S_UPPER_SRCS :=
O_SRCS :=
CC_DEPS :=
C++_DEPS :=
EXECUTABLES :=
OBJS :=
C_UPPER_DEPS :=
CXX_DEPS :=
CPP_DEPS :=
C_DEPS :=
# Every subdirectory with source files must be described here
SUBDIRS := \
hal_i386 \
. \
sim \
sim/xyssl \
子目录.mk
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/xyssl/des.c
OBJS += \
./sim/xyssl/des.o
C_DEPS += \
./sim/xyssl/des.d
# Each subdirectory must supply rules for building sources it contributes
sim/xyssl/des.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/xyssl/des.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
子目录.mk
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/STK_application.c \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/aes.c \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/auth_comp128.c \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/auth_comp128_v23.c \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/auth_gost.c \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/commands_2G.c \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/commands_3G.c \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/commands_adm.c \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/commands_auth.c \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/commands_network_auth.c \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/commands_toolkit.c \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/fs.c \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/fstream.c \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/milenage.c \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/sim_access.c \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/sim_toolkit.c \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/sw.c \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/t0.c \
C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/tools.c
OBJS += \
./sim/STK_application.o \
./sim/aes.o \
./sim/auth_comp128.o \
./sim/auth_comp128_v23.o \
./sim/auth_gost.o \
./sim/commands_2G.o \
./sim/commands_3G.o \
./sim/commands_adm.o \
./sim/commands_auth.o \
./sim/commands_network_auth.o \
./sim/commands_toolkit.o \
./sim/fs.o \
./sim/fstream.o \
./sim/milenage.o \
./sim/sim_access.o \
./sim/sim_toolkit.o \
./sim/sw.o \
./sim/t0.o \
./sim/tools.o
C_DEPS += \
./sim/STK_application.d \
./sim/aes.d \
./sim/auth_comp128.d \
./sim/auth_comp128_v23.d \
./sim/auth_gost.d \
./sim/commands_2G.d \
./sim/commands_3G.d \
./sim/commands_adm.d \
./sim/commands_auth.d \
./sim/commands_network_auth.d \
./sim/commands_toolkit.d \
./sim/fs.d \
./sim/fstream.d \
./sim/milenage.d \
./sim/sim_access.d \
./sim/sim_toolkit.d \
./sim/sw.d \
./sim/t0.d \
./sim/tools.d
# Each subdirectory must supply rules for building sources it contributes
sim/STK_application.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/STK_application.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
sim/aes.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/aes.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
sim/auth_comp128.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/auth_comp128.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
sim/auth_comp128_v23.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/auth_comp128_v23.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
sim/auth_gost.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/auth_gost.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
sim/commands_2G.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/commands_2G.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
sim/commands_3G.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/commands_3G.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
sim/commands_adm.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/commands_adm.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
sim/commands_auth.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/commands_auth.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
sim/commands_network_auth.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/commands_network_auth.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
sim/commands_toolkit.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/commands_toolkit.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
sim/fs.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/fs.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
sim/fstream.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/fstream.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
sim/milenage.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/milenage.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
sim/sim_access.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/sim_access.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
sim/sim_toolkit.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/sim_toolkit.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
sim/sw.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/sw.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
sim/t0.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/t0.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
sim/tools.o: C:/Users/ruslan/Downloads/SIM/1.USIM_sources/trunk/sim/tools.c
@echo 'Building file: $<'
@echo 'Invoking: GCC C Compiler'
gcc -DMIN_GW -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/hal_i386" -I"C:\Users\ruslan\Downloads\SIM\workspace.mingw../../1.USIM_sources/trunk/sim/xyssl" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '
编辑:除了 MinGW Make 之外,我还尝试使用 GNU32 Make 工具进行构建 - 同样的问题。
提前致谢
【问题讨论】: