Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 4 commits
  • 5 files changed
  • 0 comments
  • 1 contributor
3  software/bios/Makefile
@@ -24,6 +24,9 @@ bios-rescue.elf: linker-rescue.ld $(OBJECTS) libs
24 24
 		-lbase -lcompiler_rt
25 25
 	chmod -x $@
26 26
 
  27
+%.o: %.c
  28
+	$(compile-dep)
  29
+
27 30
 libs:
28 31
 	make -C $(M2DIR)/software/libbase
29 32
 
40  software/common.mak
... ...
@@ -1,20 +1,17 @@
1  
-# Mico32 toolchain
2  
-#
3  
-CROSS_COMPILER=lm32-elf-
4  
-# TODO: mico32 should be renamed lm32 in LLVM
5  
-CLANG=clang -ccc-host-triple mico32-elf
  1
+TARGET_PREFIX=lm32-elf
  2
+CLANG=clang -ccc-host-triple $(TARGET_PREFIX)
6 3
 
7 4
 CC_normal := $(CLANG)
8  
-AR_normal := $(CROSS_COMPILER)ar
9  
-LD_normal := $(CROSS_COMPILER)ld
10  
-OBJCOPY_normal := $(CROSS_COMPILER)objcopy
11  
-RANLIB_normal := $(CROSS_COMPILER)ranlib
  5
+AR_normal := $(TARGET_PREFIX)-ar
  6
+LD_normal := $(TARGET_PREFIX)-ld
  7
+OBJCOPY_normal := $(TARGET_PREFIX)-objcopy
  8
+RANLIB_normal := $(TARGET_PREFIX)-ranlib
12 9
 
13 10
 CC_quiet = @echo " CC " $@ && $(CLANG)
14  
-AR_quiet = @echo " AR " $@ && $(CROSS_COMPILER)ar
15  
-LD_quiet = @echo " LD " $@ && $(CROSS_COMPILER)ld
16  
-OBJCOPY_quiet = @echo " OBJCOPY " $@ && $(CROSS_COMPILER)objcopy
17  
-RANLIB_quiet = @echo " RANLIB  " $@ && $(CROSS_COMPILER)ranlib
  11
+AR_quiet = @echo " AR " $@ && $(TARGET_PREFIX)-ar
  12
+LD_quiet = @echo " LD " $@ && $(TARGET_PREFIX)-ld
  13
+OBJCOPY_quiet = @echo " OBJCOPY " $@ && $(TARGET_PREFIX)-objcopy
  14
+RANLIB_quiet = @echo " RANLIB  " $@ && $(TARGET_PREFIX)-ranlib
18 15
 
19 16
 ifeq ($(V),1)
20 17
     CC = $(CC_normal)
@@ -40,11 +37,12 @@ LDFLAGS = -nostdlib -nodefaultlibs
40 37
 # compile and generate dependencies, based on
41 38
 # http://scottmcpeak.com/autodepend/autodepend.html
42 39
 
43  
-%.o: $(SRCDIR)%.c
44  
-	$(CC) -c $(CFLAGS) $(SRCDIR)$*.c -o $*.o
45  
-	@$(CC_normal) -MM $(CFLAGS) $(SRCDIR)$*.c > $*.d
46  
-	@mv -f $*.d $*.d.tmp
47  
-	@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
48  
-	@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
49  
-	  sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
50  
-	@rm -f $*.d.tmp
  40
+define compile-dep =
  41
+$(CC) -c $(CFLAGS) $< -o $*.o
  42
+@$(CC_normal) -MM $(CFLAGS) $< > $*.d
  43
+@mv -f $*.d $*.d.tmp
  44
+@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
  45
+@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
  46
+	sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
  47
+@rm -f $*.d.tmp
  48
+endef
16  software/compiler-rt/lm32.mk
... ...
@@ -1,16 +0,0 @@
1  
-Description := LatticeMico32
2  
-
3  
-Configs := lm32
4  
-Arch := lm32
5  
-
6  
-CC := clang
7  
-
8  
-# TODO: mico32 should be renamed lm32 in LLVM
9  
-CFLAGS := -Wall -Werror -O3 -D_YUGA_LITTLE_ENDIAN=0 -D_YUGA_BIG_ENDIAN=1 -ccc-host-triple mico32-elf
10  
-
11  
-FUNCTIONS := divsi3 modsi3 comparedf2 negsf2 negdf2 addsf3 subsf3 mulsf3 divsf3 \
12  
-  floatsisf floatunsisf fixsfsi fixunssfsi adddf3 subdf3 muldf3 divdf3 floatsidf floatunsidf fixdfsi fixunsdfsi
13  
-
14  
-# Those are already implemented in HW and should not be needed.
15  
-# But the other functions directly depend on them.
16  
-FUNCTIONS += udivsi3 lshrdi3 muldi3 ashldi3
6  software/include/base/stdio.h
@@ -12,6 +12,12 @@ int sprintf(char *buf, const char *fmt, ...);
12 12
 
13 13
 int printf(const char *fmt, ...);
14 14
 
  15
+/* Not sure this belongs here... */
  16
+typedef long long loff_t;
  17
+typedef long off_t;
  18
+typedef int mode_t;
  19
+typedef int dev_t;
  20
+
15 21
 /*
16 22
  * Note: this library does not provide FILE operations.
17 23
  * User code must implement them.
3  software/libbase/Makefile
@@ -12,6 +12,9 @@ libbase.a: $(OBJECTS)
12 12
 	$(AR) clr libbase.a $(OBJECTS)
13 13
 	$(RANLIB) libbase.a
14 14
 
  15
+%.o: %.c
  16
+	$(compile-dep)
  17
+
15 18
 .PHONY: clean
16 19
 
17 20
 clean:

No commit comments for this range

Something went wrong with that request. Please try again.