के लिए आदेश ओवरराइड करना मेकफ़ाइल के हिस्से के रूप में मैं या तो लक्ष्य का डीबग या रिलीज़ संस्करण बनाना चाहता हूं।फ़ाइल चेतावनी बनाएं, लक्ष्य
कार्यात्मक रूप से, सब कुछ, तथापि, मैं हो रही है चेतावनी काम कर रहा है जब चल कर
12 SRC := $(shell echo src/*.cpp)
13 SRC += $(shell echo $(TEST_ROOT)/*.cpp)
14
15 D_OBJECTS = $(SRC:.cpp=.o) # same objects will need to be built differently
16 R_OBJECTS = $(SRC:.cpp=.o) # same objects will need to be built differently
22 all: $(TARGET)
23
25 $(TARGET): $(D_OBJECTS)
26 $(CC) $(D_OBJECTS) -o $(TARGET)
27
28 $(D_OBJECTS) : %.o: %.cpp # ----- run with debug flags
29 $(CC) $(COMMON_FLAGS) $(DEBUG_FLAGS) -c $< -o [email protected]
30
31 release: $(R_OBJECTS)
32 $(CC) $(R_OBJECTS) -o $(TARGET)
33
34 $(R_OBJECTS) : %.o: %.cpp # ----- run with release flags
35 $(CC) $(COMMON_FLAGS) $(RELEASE_FLAGS) -c $< -o [email protected]
जब मैं make
मैं डिबग संस्करण प्राप्त, जब मैं make release
मैं रिलीज़ संस्करण मिलता है।
लेकिन मैं भी मिल चेतावनी:
Makefile:35: warning: overriding commands for target `src/Timer.o'
Makefile:29: warning: ignoring old commands for target `src/Timer.o'
Makefile:35: warning: overriding commands for target `test/TimerTest.o'
Makefile:29: warning: ignoring old commands for target `test/TimerTest.o'
यह 2 प्रश्नों के साथ
:
- चेतावनी
- अनदेखी करने के लिए किसी भी तरह से मैं चीजों को सही कर रहा हूं? क्या परिवर्तन की जरूरत है?
क्या आप जानते हैं कि नेटबीन्स में ऑटो को मेकफ़ाइल उत्पन्न करने वाले ऑटोबेन्स में ऐसा कैसे करना है? –
या यदि आपके पास एकाधिक बाइनरी के लिए एक ही कोड है तो लाइब्रेरी बनाएं – baptx