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 ---------- |
---|
9 | FILE = nralloc1.c, nralloc2.c, nralloc2x.c, nrarith0.c, nrarith1.c, nrarith2.c, nrarith2x.c, nrbool1.c, nrbool2.c, nrhisto.c, nrio0.c, nrio1.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 |
---|
10 | |
---|
11 | |
---|
12 | TARGET ?= linux |
---|
13 | |
---|
14 | # -- Paths ---------- |
---|
15 | SRC_PATH = src |
---|
16 | OBJ_PATH = obj |
---|
17 | INC_PATH = include |
---|
18 | |
---|
19 | ifeq ($(TARGET),giet-vm) |
---|
20 | |
---|
21 | CC = mipsel-unknown-elf-gcc |
---|
22 | AR = mipsel-unknown-elf-ar |
---|
23 | RANLIB = mipsel-unknown-elf-ranlib |
---|
24 | AS = mipsel-unknown-elf-as |
---|
25 | OD = mipsel-unknown-elf-objdump |
---|
26 | OCPY = mipsel-unknown-elf-objcopy |
---|
27 | LD = mipsel-unknown-elf-ld |
---|
28 | NM = mipsel-unknown-elf-nm |
---|
29 | |
---|
30 | |
---|
31 | C_DEBUG_FLAGS = -O0 |
---|
32 | C_OPTIMISATION_FLAGS = -std=c99 -O2 -fstrict-aliasing |
---|
33 | C_OS_FLAGS = -DGTODay -DTARGET_OS=GIETVM |
---|
34 | C_CONFIG_FLAGS = -DCLI |
---|
35 | C_INC_FLAGS = -I$(INC_PATH) -I../../.. -I../../../giet_libs |
---|
36 | CFLAGSCPU := -mips32 -EL -G0 -mhard-float |
---|
37 | |
---|
38 | endif |
---|
39 | |
---|
40 | ifeq ($(TARGET),linux) |
---|
41 | |
---|
42 | CC = gcc |
---|
43 | LD = gcc |
---|
44 | AR = ar |
---|
45 | RANLIB = ranlib |
---|
46 | |
---|
47 | C_DEBUG_FLAGS = -O0 |
---|
48 | C_OPTIMISATION_FLAGS = -std=c99 -O2 -fstrict-aliasing |
---|
49 | C_OS_FLAGS = -DGTODay -DTARGET_OS=LINUX |
---|
50 | C_CONFIG_FLAGS = -DCLI |
---|
51 | C_INC_FLAGS = -I$(INC_PATH) |
---|
52 | |
---|
53 | endif |
---|
54 | |
---|
55 | |
---|
56 | # -- Flags ---------- |
---|
57 | CFLAGS = $(C_OPTIMISATION_FLAGS) $(C_OS_FLAGS) $(C_INC_FLAGS) |
---|
58 | |
---|
59 | |
---|
60 | #------------------------------------------------------------------------------ |
---|
61 | # CC tools and parameters |
---|
62 | #------------------------------------------------------------------------------ |
---|
63 | |
---|
64 | CFLAGSW := -Wredundant-decls -Wdisabled-optimization -Winline -Wpointer-arith -Wsign-compare -Wendif-labels |
---|
65 | CFLAGS := $(CFLAGS) -g -Wall -fomit-frame-pointer $(CFLAGSW) $(CFLAGSCPU) -fno-builtin -ffreestanding |
---|
66 | |
---|
67 | |
---|
68 | PRODUCT = libnrc2x.a |
---|
69 | |
---|
70 | OBJS = $(addprefix $(OBJ_PATH)/, $(addsuffix .o, $(basename $(FILE)))) |
---|
71 | |
---|
72 | all: $(PRODUCT) |
---|
73 | |
---|
74 | $(OBJ_PATH)/%.o: $(SRC_PATH)/%.c |
---|
75 | $(CC) -c $(CFLAGS) -o $@ $< |
---|
76 | |
---|
77 | |
---|
78 | $(PRODUCT): $(OBJS) |
---|
79 | $(AR) -cr $@ $^ |
---|
80 | $(RANLIB) $@ |
---|
81 | |
---|
82 | clean: |
---|
83 | rm -f $(OBJS) |
---|
84 | rm -f $(PRODUCT) |
---|
85 | |
---|