Makefile 1.94 KB
Newer Older
1 2 3
# All files are under A (short for ARCH): I'm lazy
A := arch-$(ARCH)

baujc's avatar
baujc committed
4 5 6
# classic cross-compilation tool-set
SIZE =		$(CROSS_COMPILE)size

7
CFLAGS += -Itools
8 9
# Prevent a warning for a missing prototype in pp_printf, bug since ever
ARCH_PP_PRINTF_CFLAGS += -include ../$A/include/strnlen.h
10

11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
arch-spec-c = $A/wrs-startup.c \
	$A/hal_minirpc.c \
	$A/main-loop.c \
	$A/wrs-io.c \
	$A/wrs-conf.c \
	$A/wrs-calibration.c \
	$A/wrs-port.c \
	$A/wrs-ipcserver.c \
	$A/shmem.c \
	$A/util.c \
	lib/cmdline.c \
	lib/conf.c \
	lib/libc-functions.c \
	lib/dump-funcs.c \
	lib/drop.c \
	lib/assert.c \
	lib/div64.c \
	lib/time-arith.c

arch-spec-o = $(patsubst %.c,%.o,$(arch-spec-c))

OBJ-y += $(arch-spec-o)

# build symbolic links for libwr
hal_headers = hal_shmem.h \
	generic_fsm.h\
	sfp_lib.h\
	util.h\
	shmem.h	\
	timeout.h

hal_headers_in_ppsi= $(addprefix $A/include/libwr/,$(hal_headers))

$(arch-spec-o) : $(hal_headers_in_ppsi)

$(hal_headers_in_ppsi):
	@f=$(notdir $@); \
	echo "Creating symbolic link to $$f";\
	ln -sf ../../../../libwr/include/libwr/$$f  $@
50

baujc's avatar
baujc committed
51 52 53
export size_db_file:=size_wrs_db.txt
export size_info_file:=size_wrs_info.txt

54
# We only support "wrs" time operations
55
TIME = wrs
56 57 58 59
include time-$(TIME)/Makefile

# Unix time operations are always included as a fallback
include time-unix/Makefile
60
CFLAGS += -Iproto-ext-whiterabbit -Iproto-standard
61

62
# mini-rpc directory contains minipc library
63
export CROSS_COMPILE
64 65
MINIPC_DIR := $A/mini-rpc
MINIPC_LIB := $(MINIPC_DIR)/libminipc.a
66
CFLAGS += -I$(MINIPC_DIR)
67 68
.PHONY: $(MINIPC_LIB)
$(MINIPC_LIB):
baujc's avatar
baujc committed
69
	$(MAKE) -C $(MINIPC_DIR) CFLAGS_OPTIMIZATION="$(CFLAGS_OPTIMIZATION)"
70

71
OBJ-y += $(MINIPC_LIB)
72 73 74

all: $(TARGET)

75 76 77
clean::
	rm -f $(hal_headers_in_ppsi)

78
# to build the target, we need -lstd again, in case we call functions that
79
# were not selected yet (e.g., pp_init_globals() ).
80 81
$(TARGET): $(TARGET).o
	$(CC) -Wl,-Map,$(TARGET).map2 -o $@ $(TARGET).o -lrt
baujc's avatar
baujc committed
82 83
	$(SIZE) $@
	./arch-wrs/save_size.sh $(SIZE) $@
84
	tail -20 $(size_info_file)
baujc's avatar
baujc committed
85

86