Browse Source

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

Isaku Yamahata 4 years ago
parent
commit
26fb253b58
1 changed files with 8 additions and 0 deletions
  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-$@)