Makefile 1.06 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
# Alessandro Rubini for CERN, 2011 -- public domain

# All files are under A (short for ARCH): I'm lazy
A := arch-$(ARCH)

CFLAGS += -DCONFIG_PPSI_RUNTIME_VERBOSITY -Itools


LIBARCH := $A/libarch.a

OBJ-libarch := $A/wrs-startup.o \
	$A/main-loop.o \
	$A/wrs-io.o \
14
	$A/wrs-calibration.o \
15 16 17 18 19 20
	lib/cmdline.o \
	lib/conf.o \
	lib/libc-functions.o \
	lib/dump-funcs.o \
	lib/div64.o

21 22
# The user can set TIME=, but wrs is default
TIME ?= wrs
23 24 25 26 27

include time-$(TIME)/Makefile

# Unix time operations are always included as a fallback
include time-unix/Makefile
28
CFLAGS += -Itime-unix
29

30 31 32 33 34 35 36 37
# mini-rpc directory contains minipc library
MINIPC_DIR := $A/mini-rpc
MINIPC_LIB := $(MINIPC_DIR)/libminipc.a
.PHONY: $(MINIPC_LIB)
$(MINIPC_LIB):
	make -C $(MINIPC_DIR)

$(LIBARCH): $(OBJ-libarch) $(MINIPC_LIB)
38 39 40 41 42 43 44 45
	$(AR) r $@ $^

all: $(TARGET)

# to build the target, we need -lstd again, in case we call functions that
# were not selected yet (e.g., pp_open_globals() ).
$(TARGET): $(TARGET).o $(LIBARCH)
	$(CC) -Wl,-Map,$(TARGET).map2 -o $@ $(TARGET).o \
46
		-L$A -larch -L$D -L$(MINIPC_DIR) -lminipc -lstd -lrt
47