1 # arch/niosnommu/Makefile
3 # Makefile for the architecture dependent flags and dependencies on the
6 # Copyright (C) 2001 Vic Phillips (vic@microtronix.com)
8 # based on sparcnommu/Makefile:
10 # Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
12 KERNELLOAD
= ${shell echo
`grep "nasys_program_mem " include/asm/nios.h | sed 's/^.*\*)//' | sed 's/)//'`}
14 HARDWARE_MK
= arch
/$(ARCH
)/hardware.mk
16 platform-
$(CONFIG_NIOS
) := NIOS2
17 PLATFORM
:= $(platform-y
)
19 board-
$(CONFIG_ALTERA_STRATIX
) := altera_stratix
20 board-
$(CONFIG_ALTERA_STRATIX_PRO
) := altera_stratix_pro
21 board-
$(CONFIG_ALTERA_STRATIX_II
) := altera_stratix_ii
22 board-
$(CONFIG_ALTERA_CYCLONE
) := altera_cyclone
23 board-
$(CONFIG_ALTERA_CYCLONE_1C12_EVAL
) := altera_cyclone_1c12_eval
24 board-
$(CONFIG_MICROTRONIX_STRATIX
) := microtronix_stratix
25 board-
$(CONFIG_MICROTRONIX_CYCLONE
) := microtronix_cyclone
26 board-
$(CONFIG_MICROTRONIX_UKIT
) := microtronix_ukit
27 board-
$(CONFIG_MICROTRONIX_PSK
) := microtronix_psk
30 model-
$(CONFIG_RAMKERNEL
) := ram
31 model-
$(CONFIG_ROMKERNEL
) := rom
32 model-
$(CONFIG_HIMEMKERNEL
) := himem
35 export PLATFORM BOARD MODEL
37 CFLAGS
+= -DNO_MM
-pipe
-D__linux__
-D__ELF__
38 #CFLAGS += -DNO_MM -save-temps -D__linux__ -D__ELF__
40 # Uncomment this if you are doing gdb source level
41 # debugging of the kernel to get the proper debugging information.
45 # Turn on/off various hardware multiply options
46 cpu-cflags-
$(CONFIG_NIOS2_HW_MUL_OFF
) += -mno-hw-mul
-mno-hw-mulx
47 cpu-cflags-
$(CONFIG_NIOS2_HW_MUL
) += -mhw-mul
-mno-hw-mulx
48 cpu-cflags-
$(CONFIG_NIOS2_HW_MULX
) += -mhw-mul
-mhw-mulx
49 CFLAGS
+= $(cpu-cflags-y
)
51 # mulx flags currently cause older version of nios2-elf-gcc to fail
52 # The following line ensures that all mulx flags are removed before
53 # it is passed to the compiler.
54 mulx_help_text
:= $(shell $(CC
) --target-help | grep mulx
)
55 ifeq "$(mulx_help_text)" ""
56 CFLAGS
:= $(filter-out -mhw-mulx
-mno-hw-mulx
, $(CFLAGS
))
59 # Temporary workaround for nios2-elf-gcc bug
60 # First noticed in v3.4.1 (Altera Nios II 1.1 b131)
61 # To be removed at a later date when bug is resolved.
62 CFLAGS
+= -fno-optimize-sibling-calls
64 # This undefines the "__init" type used in defining initialization
65 # procedures. When defined, the procedures are put into an 'init' data
66 # section that GDB doesn't recognize as source.
68 CFLAGS
+= -DNO_TEXT_SECTIONS
69 CFLAGS
+= -fno-builtin
71 CFLAGS
+= -DUTS_SYSNAME
=\"uClinux
\"
73 CFLAGS_GCC_INC
:= $(shell $(CC
) -print-file-name
=include)
74 CFLAGS
+= -I
$(CFLAGS_GCC_INC
)
77 #AFLAGS += -DNO_MM -g -save-temps
79 # vic - add this to get name of nios gcc library
80 LIBGCC_CFLAGS
= $(if
$(CONFIG_NIOS2_HW_MUL_OFF
),-mno-hw-mul
)
81 LIBGCC
:= `$(CC) --print-libgcc-file-name $(LIBGCC_CFLAGS)`
83 # add this to avoid multiple '_stack' and '_vecbase' definition errors
86 # Include the path to the lib directory where the ldscripts are found to fix
87 # a problem with the cygwin/bash environment.
89 #cygwhack: kenw - this following section could be a possible problem
90 # due to the O= option on the command line.
91 LDSCRIPTS
:=$(shell nios2-elf-gcc
-print-file-name
=ldscripts
)
92 LDFLAGS
+= -mnios2elf
-L
$(LDSCRIPTS
)/..
95 LDLIBS
:= -L
`$(CC) -print-file-name=m32` -l gcc
98 head-y
:= arch
/nios2nommu
/kernel
/head.o arch
/nios2nommu
/kernel
/init_task.o
100 CLEAN_FILES
:= include/asm-
$(ARCH
)/asm-offsets.h \
102 arch
/$(ARCH
)/kernel
/asm-offsets.s \
108 core-y
+= arch
/nios2nommu
/kernel
/ \
109 arch
/nios2nommu
/mm
/ \
110 arch
/nios2nommu
/drivers
/
112 libs-y
+= arch
/nios2nommu
/lib
/
117 # force user to configure hardware before building kernel
119 pardoned_targets
= clean mrproper sgmldocs psdocs pdfdocs \
122 -include $(HARDWARE_MK
)
123 build_targets
= $(filter-out $(pardoned_targets
), $(MAKECMDGOALS
))
124 ifneq '$(strip $(build_targets))' ''
126 ifneq '$(firstword $(MAKECMDGOALS))' 'hwselect'
127 $(error Run
"make hwselect SYSPTF=<system.ptf>" first
)
132 quiet_cmd_gen_mk
= ' RUNNING $@'
134 mkdir
-p
$(dir $(objtree
)/$(HARDWARE_MK
)); \
135 perl
-I
$(TOPDIR
)/arch
/$(ARCH
)/scripts \
136 $(srctree
)/arch
/$(ARCH
)/scripts
/hwselect.pl
$(SYSPTF
) \
137 $(objtree
)/$(HARDWARE_MK
)
142 @echo
$($(quiet
)cmd_gen_mk
);
145 prepare
: include/nios2_system.h
148 $(call descend arch
/$(ARCH
)/boot
, subdirclean
)
150 define filechk_nios2_system.h
151 # call perl script that will build nios2_system.h file
152 perl
-I
$(TOPDIR
)/arch
/$(ARCH
)/scripts \
153 $(TOPDIR
)/arch
/$(ARCH
)/scripts
/gen_nios2_system.h.pl
$(CPU
) $(EXEMEM
) $(UPLMEM
)
156 include/nios2_system.h
: $(SYSPTF
) FORCE
157 $(call filechk
,nios2_system.h
)
159 quiet_cmd_touch
= ' TOUCH $@'
160 cmd_touch
= touch
$(TOPDIR
)/$@
162 arch
/$(ARCH
)/kernel
/vmlinux.lds.S
: FORCE
163 @echo
$($(quiet
)cmd_touch
);
167 $(OBJCOPY
) -O srec
$(LINUX
) linux.srec
169 boot
:= arch
/nios2nommu
/boot
172 $(Q
)$(MAKE
) $(build
)=$(boot
) $(boot
)/$@
176 CLEAN_FILES
+= include/nios2_system.h