瀏覽代碼

Makefile.rules: Add new rule to build executable from single .c/.cpp

Isaku Yamahata 6 年之前
父節點
當前提交
26fb253b58
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      Makefile.rules

+ 8 - 0
Makefile.rules

@@ -114,3 +114,11 @@ quiet_cmd_objcopy = [ $@ ]
 # This depends on the output of readelf command.
 quiet_cmd_check_no_reloc = [ check_no_reloc $^ ]
       cmd_check_no_reloc = LC_ALL=C readelf -r $^ | grep -q 'There are no relocations in this file.'
+
+# single .c => executable
+quiet_cmd_csingle  = [ $@ ]
+      cmd_csingle  = $(CC) -MD -MP $(CFLAGS) $(CFLAGS-$@) -o $@ $< $(LDLIBS) $(LDLIBS-$@)
+
+# single .cpp => executable
+quiet_cmd_cxxsingle  = [ $@ ]
+      cmd_cxxsingle  = $(CXX) -MD -MP $(CXXFLAGS) $(CXXFLAGS-$@) -o $@ $< $(LDLIBS) $(LDLIBS-$@)