[772] | 1 | # ------------------ # |
---|
| 2 | # -- NRC Makefile -- # |
---|
| 3 | # ------------------ # |
---|
| 4 | |
---|
| 5 | # Copyright (c) 2000-2007 Lionel Lacassagne |
---|
| 6 | # with a little help of Stephane Piskorski and Joel Falcou |
---|
| 7 | |
---|
| 8 | # -- File list ---------- |
---|
[822] | 9 | FILE = nralloc1.c, nralloc2.c, nralloc2x.c, nrarith0.c, nrarith1.c, nrarith2.c, nrarith2x.c, nrbool1.c, nrbool2.c, nrio0.c, nrio1.c, nrio1x.c, nrio2.c, nrlinalg.c, nrlut.c, nrmem1.c, nrmem1x.c, nrmem2.c, nrmem2x.c, nrset1.c, nrset2.c, nrset2x.c, nrsort1.c, nrsort2.c, nrwrap1.c, nrwrap2.c |
---|
[823] | 10 | FILE := $(FILE), nrio1f.c, nrio1xf.c, nrio2f.c nrio2x.c nrio2xf.c nrio3.c # comment if giet |
---|
[772] | 11 | |
---|
| 12 | |
---|
[821] | 13 | TARGET ?= linux |
---|
[772] | 14 | |
---|
| 15 | # -- Paths ---------- |
---|
| 16 | SRC_PATH = src |
---|
| 17 | OBJ_PATH = obj |
---|
| 18 | INC_PATH = include |
---|
[822] | 19 | PRODUCT = libnrc2x.a |
---|
[772] | 20 | |
---|
[822] | 21 | all: checktarget $(PRODUCT) |
---|
| 22 | |
---|
[821] | 23 | ifeq ($(TARGET),giet-vm) |
---|
[772] | 24 | |
---|
[821] | 25 | CC = mipsel-unknown-elf-gcc |
---|
| 26 | AR = mipsel-unknown-elf-ar |
---|
| 27 | RANLIB = mipsel-unknown-elf-ranlib |
---|
| 28 | AS = mipsel-unknown-elf-as |
---|
| 29 | OD = mipsel-unknown-elf-objdump |
---|
| 30 | OCPY = mipsel-unknown-elf-objcopy |
---|
| 31 | LD = mipsel-unknown-elf-ld |
---|
| 32 | NM = mipsel-unknown-elf-nm |
---|
| 33 | |
---|
| 34 | |
---|
[772] | 35 | C_DEBUG_FLAGS = -O0 |
---|
| 36 | C_OPTIMISATION_FLAGS = -std=c99 -O2 -fstrict-aliasing |
---|
[798] | 37 | C_OS_FLAGS = -DGTODay -DTARGET_OS=GIETVM |
---|
[772] | 38 | C_CONFIG_FLAGS = -DCLI |
---|
| 39 | C_INC_FLAGS = -I$(INC_PATH) -I../../.. -I../../../giet_libs |
---|
[821] | 40 | CFLAGSCPU := -mips32 -EL -G0 -mhard-float |
---|
[772] | 41 | |
---|
[822] | 42 | checktarget: |
---|
| 43 | @if [ -f $(PRODUCT) ] && objdump -f $(PRODUCT) | grep "little" > /dev/null ; then \ |
---|
| 44 | echo -ne "" ; \ |
---|
| 45 | else \ |
---|
| 46 | rm -f $(OBJS) $(PRODUCT) ;\ |
---|
| 47 | fi |
---|
[821] | 48 | endif |
---|
| 49 | |
---|
| 50 | ifeq ($(TARGET),linux) |
---|
| 51 | |
---|
| 52 | CC = gcc |
---|
| 53 | LD = gcc |
---|
| 54 | AR = ar |
---|
| 55 | RANLIB = ranlib |
---|
| 56 | |
---|
| 57 | C_DEBUG_FLAGS = -O0 |
---|
| 58 | C_OPTIMISATION_FLAGS = -std=c99 -O2 -fstrict-aliasing |
---|
| 59 | C_OS_FLAGS = -DGTODay -DTARGET_OS=LINUX |
---|
| 60 | C_CONFIG_FLAGS = -DCLI |
---|
| 61 | C_INC_FLAGS = -I$(INC_PATH) |
---|
| 62 | |
---|
[822] | 63 | checktarget: |
---|
| 64 | @if [ -f $(PRODUCT) ] && objdump -f $(PRODUCT) | grep "86" > /dev/null ; then \ |
---|
| 65 | echo -ne "" ; \ |
---|
| 66 | else \ |
---|
| 67 | rm -f $(OBJS) $(PRODUCT) ;\ |
---|
| 68 | fi |
---|
| 69 | |
---|
[821] | 70 | endif |
---|
| 71 | |
---|
| 72 | |
---|
[772] | 73 | # -- Flags ---------- |
---|
| 74 | CFLAGS = $(C_OPTIMISATION_FLAGS) $(C_OS_FLAGS) $(C_INC_FLAGS) |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | #------------------------------------------------------------------------------ |
---|
| 78 | # CC tools and parameters |
---|
| 79 | #------------------------------------------------------------------------------ |
---|
| 80 | |
---|
| 81 | CFLAGSW := -Wredundant-decls -Wdisabled-optimization -Winline -Wpointer-arith -Wsign-compare -Wendif-labels |
---|
[798] | 82 | CFLAGS := $(CFLAGS) -g -Wall -fomit-frame-pointer $(CFLAGSW) $(CFLAGSCPU) -fno-builtin -ffreestanding |
---|
[772] | 83 | |
---|
| 84 | |
---|
| 85 | |
---|
| 86 | OBJS = $(addprefix $(OBJ_PATH)/, $(addsuffix .o, $(basename $(FILE)))) |
---|
| 87 | |
---|
| 88 | |
---|
[822] | 89 | $(OBJ_PATH)/%.o: $(SRC_PATH)/%.c $(INC_PATH)/*.h |
---|
[772] | 90 | $(CC) -c $(CFLAGS) -o $@ $< |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | $(PRODUCT): $(OBJS) |
---|
[821] | 94 | $(AR) -cr $@ $^ |
---|
[793] | 95 | $(RANLIB) $@ |
---|
[772] | 96 | |
---|
| 97 | clean: |
---|
| 98 | rm -f $(OBJS) |
---|
| 99 | rm -f $(PRODUCT) |
---|
| 100 | |
---|