[772] | 1 | |
---|
| 2 | # -- Paths ---------- |
---|
[805] | 3 | SRC_PATH = src-par |
---|
[772] | 4 | OBJ_PATH = obj |
---|
| 5 | INC_PATH = include |
---|
| 6 | |
---|
[798] | 7 | TARGET ?= linux |
---|
[823] | 8 | IGNORE_ASSERT ?= false |
---|
| 9 | |
---|
[798] | 10 | # |
---|
| 11 | # -- Config ---------- |
---|
[772] | 12 | |
---|
[798] | 13 | ifeq ($(TARGET),giet-vm) |
---|
| 14 | |
---|
[826] | 15 | CC = mipsel-unknown-elf-gcc |
---|
| 16 | LD = mipsel-unknown-elf-ld |
---|
| 17 | |
---|
[772] | 18 | C_OPTIM_FLAGS = -std=c99 -O2 -fstrict-aliasing |
---|
[826] | 19 | C_OS_FLAGS = -DTARGET_OS=GIETVM |
---|
| 20 | C_CONFIG_FLAGS = -static-libgcc -lgcc |
---|
[772] | 21 | C_INC_FLAGS = -I$(INC_PATH) -Inrc2/include -I../.. -I../../giet_libs -I../../giet_xml/ |
---|
[823] | 22 | CFLAGSCPU = -mips32 -EL -G0 -mhard-float -fomit-frame-pointer -fno-builtin -ffreestanding |
---|
[772] | 23 | |
---|
[826] | 24 | GCC_LIB = -L$(shell $(CC) -print-libgcc-file-name | sed 's/libgcc.a//') |
---|
| 25 | LDFLAGS = $(GCC_LIB) -Lnrc2 -L../../build/libs -Trosenfeld.ld --start-group -lnrc2x -luser -lmath -lgcc --end-group |
---|
[798] | 26 | |
---|
| 27 | endif |
---|
| 28 | |
---|
| 29 | ifeq ($(TARGET),linux) |
---|
| 30 | |
---|
| 31 | CC = gcc |
---|
| 32 | LD = gcc |
---|
| 33 | |
---|
| 34 | # -- Config ---------- |
---|
| 35 | C_OPTIM_FLAGS = -std=c99 -O2 -fstrict-aliasing |
---|
[826] | 36 | C_OS_FLAGS = -DTARGET_OS=LINUX -D_GNU_SOURCE |
---|
| 37 | C_CONFIG_FLAGS = |
---|
[798] | 38 | C_INC_FLAGS = -I$(INC_PATH) -Inrc2/include |
---|
| 39 | CFLAGSCPU = |
---|
[823] | 40 | ifeq ($(IGNORE_ASSERT),true) |
---|
| 41 | C_OPTIM_FLAGS := $(C_OPTIM_FLAGS) -DNDEBUG |
---|
| 42 | endif |
---|
[798] | 43 | |
---|
[823] | 44 | LDFLAGS = -Lnrc2 -Wl,--start-group -lnrc2x -lm -lpthread -Wl,--end-group |
---|
[798] | 45 | |
---|
| 46 | endif |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | |
---|
[823] | 50 | CFLAGSW = -Wredundant-decls -Wdisabled-optimization -Winline -Wpointer-arith -Wsign-compare -Wendif-labels -Wno-unused-function -Wno-unused-variable |
---|
[798] | 51 | |
---|
[772] | 52 | # -- Flags ---------- |
---|
[798] | 53 | CFLAGS = $(C_OPTIM_FLAGS) $(C_OS_FLAGS) $(C_INC_FLAGS) $(C_CONFIG_FLAGS) -g -Wall $(CFLAGSW) $(CFLAGSCPU) |
---|
[772] | 54 | |
---|
| 55 | |
---|
[791] | 56 | APP_NAME = appli.elf |
---|
[772] | 57 | |
---|
| 58 | SRC_FILE = $(wildcard $(SRC_PATH)/*.c) |
---|
[821] | 59 | INC_FILE = $(wildcard $(INC_PATH)/*.h) |
---|
[772] | 60 | |
---|
| 61 | #SRC = $(addprefix $(SRC_PATH)/,$(FILE)) |
---|
| 62 | OBJ_FILE = $(addprefix $(OBJ_PATH)/,$(addsuffix .o, $(basename $(notdir $(SRC_FILE))))) |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | |
---|
[826] | 68 | all: objdir nrclib $(APP_NAME) |
---|
[772] | 69 | |
---|
[826] | 70 | objdir: |
---|
| 71 | mkdir -p $(OBJ_PATH) |
---|
| 72 | |
---|
[822] | 73 | nrclib: |
---|
| 74 | make -C nrc2 |
---|
| 75 | |
---|
[772] | 76 | $(APP_NAME): $(OBJ_FILE) |
---|
| 77 | $(LD) -o $@ $^ $(LDFLAGS) |
---|
| 78 | |
---|
[822] | 79 | #obj/bmpNR.o: src-par/bmpNR.c $(INC_FILE) nrc2/libnrc2x.a ../../build/libs/libuser.a nrc2/include/nrc_os_config.h |
---|
| 80 | # $(CC) -c $(CFLAGS) -o $@ $< |
---|
| 81 | |
---|
[821] | 82 | $(OBJ_PATH)/%.o: $(SRC_PATH)/%.c $(INC_FILE) nrc2/libnrc2x.a ../../build/libs/libuser.a nrc2/include/nrc_os_config.h |
---|
[772] | 83 | $(CC) -c $(CFLAGS) -o $@ $< |
---|
| 84 | |
---|
| 85 | clean: |
---|
| 86 | rm -f $(OBJ_FILE) |
---|
| 87 | rm -f $(APP_NAME) |
---|
| 88 | |
---|
| 89 | |
---|
| 90 | |
---|