Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

software/common.mak: add C++ definitions

  • Loading branch information...
commit 3640cab439a1872dd5e9691f3b4d92a9a0d52ad6 1 parent 6010308
Sébastien Bourdeauducq authored March 24, 2013

Showing 1 changed file with 18 additions and 3 deletions. Show diff stats Hide diff stats

  1. 21  software/common.mak
21  software/common.mak
... ...
@@ -1,6 +1,7 @@
1 1
 TARGET_PREFIX=lm32-elf-
2 2
 
3 3
 CC_normal := $(TARGET_PREFIX)gcc
  4
+CX_normal := $(TARGET_PREFIX)g++
4 5
 AS_normal := $(TARGET_PREFIX)as
5 6
 AR_normal := $(TARGET_PREFIX)ar
6 7
 LD_normal := $(TARGET_PREFIX)ld
@@ -8,6 +9,7 @@ OBJCOPY_normal := $(TARGET_PREFIX)objcopy
8 9
 RANLIB_normal := $(TARGET_PREFIX)ranlib
9 10
 
10 11
 CC_quiet = @echo " CC " $@ && $(TARGET_PREFIX)gcc
  12
+CX_quiet = @echo " CX " $@ && $(TARGET_PREFIX)g++
11 13
 AS_quiet = @echo " AS " $@ && $(TARGET_PREFIX)as
12 14
 AR_quiet = @echo " AR " $@ && $(TARGET_PREFIX)ar
13 15
 LD_quiet = @echo " LD " $@ && $(TARGET_PREFIX)ld
@@ -16,6 +18,7 @@ RANLIB_quiet = @echo " RANLIB  " $@ && $(TARGET_PREFIX)ranlib
16 18
 
17 19
 ifeq ($(V),1)
18 20
 	CC = $(CC_normal)
  21
+	CX = $(CX_normal)
19 22
 	AS = $(AS_normal)
20 23
 	AR = $(AR_normal)
21 24
 	LD = $(LD_normal)
@@ -23,6 +26,7 @@ ifeq ($(V),1)
23 26
 	RANLIB = $(RANLIB_normal)
24 27
 else
25 28
 	CC = $(CC_quiet)
  29
+	CX = $(CX_quiet)
26 30
 	AS = $(AS_quiet)
27 31
 	AR = $(AR_quiet)
28 32
 	LD = $(LD_quiet)
@@ -33,14 +37,25 @@ endif
33 37
 # Toolchain options
34 38
 #
35 39
 INCLUDES = -I$(M2DIR)/software/include/base -I$(M2DIR)/software/include -I$(M2DIR)/common
36  
-CFLAGS = -O3 -mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled -msign-extend-enabled \
37  
-	-Wall -Wstrict-prototypes -Wold-style-definition -Wshadow \
38  
-	-Wmissing-prototypes -fno-builtin -nostdinc $(INCLUDES)
  40
+COMMONFLAGS = -O3 -mbarrel-shift-enabled -mmultiply-enabled -mdivide-enabled -msign-extend-enabled \
  41
+	-Wall -fno-builtin -nostdinc $(INCLUDES)
  42
+CFLAGS = $(COMMONFLAGS) -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
  43
+CXXFLAGS = $(COMMONFLAGS) -fno-exceptions -ffreestanding
39 44
 LDFLAGS = -nostdlib -nodefaultlibs
40 45
 
41 46
 # compile and generate dependencies, based on
42 47
 # http://scottmcpeak.com/autodepend/autodepend.html
43 48
 
  49
+define compilexx-dep
  50
+$(CX) -c $(CXXFLAGS) $< -o $*.o
  51
+@$(CX_normal) -MM $(CXXFLAGS) $< > $*.d
  52
+@mv -f $*.d $*.d.tmp
  53
+@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
  54
+@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
  55
+	sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
  56
+@rm -f $*.d.tmp
  57
+endef
  58
+
44 59
 define compile-dep
45 60
 $(CC) -c $(CFLAGS) $< -o $*.o
46 61
 @$(CC_normal) -MM $(CFLAGS) $< > $*.d

0 notes on commit 3640cab

Please sign in to comment.
Something went wrong with that request. Please try again.