因此,当主题状态-在Eclipse /C++中自动生成makefile时,只提供了编译一个模块.我有一个用C/C++编写的Eclipse项目,它用MinGW (gcc)编译。现在,我想用makefile从命令行构建它。因此,我检查了Makefile(Makefile,objects.mk,sources.mk和所有subdir.mk-s)是否被获得。问题是,当我在适当的目录(包含Makefile)中键入并运行make时,它只编译一个文件,在这种情况下,des.c (它提供一个对象文件des.o)并退出,我不知道原因。虽然从eclipse构建成功提供了一个可执行文件作为艺术品。
为这个问题的附件道歉--尽管我认为这一切都是相关的。


在这里,它存在于文件编译之后。

下面是一个Makefile:
################################################################################
# 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的include (即包含sim/xyssl/subdir.mk),在本例中,它只编译STK_application.c,如下所示

也许这与问题的原因有关--我已经将文件/文件夹挂载为外部文件/文件夹(工作区dir之外的上层文件夹),但是--同样--它在Eclipse中工作。另外,我想说的是,无论启用还是禁用选项Expand Env. Variable Refs in Makefile,它的行为都是相同的。其他文件如下: sources.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 \subdir.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 ' 'subdir.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 ' '编辑:,我也尝试过用GNU32 Make工具构建,除了MinGW Make --同样的问题。
提前感谢
发布于 2016-03-03 08:18:59
运行所有的制造而不是仅仅制造。
如果您运行make而没有任何目标,它将默认为makefile中提到的第一个目标,在本例中是sim/xyssl/des.o。当您从Eclipse运行makefile时,我怀疑它实际上运行了make all。
https://stackoverflow.com/questions/35724831
复制相似问题