aboutsummaryrefslogtreecommitdiff
path: root/src/Makefile.linux
blob: 85d9c64385e0face7e28087ebc981f5dd7f9f5ed (plain)
1
2
3
4
5
6
7
8
9
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
50
51
# -*- makefile -*- : Force emacs to use Makefile mode

# Prefix all iPXE symbols to avoid collisions with platform libraries
#
SYMBOL_PREFIX	= _ipxe__

# Enable valgrind
#
CFLAGS		+= -UNVALGRIND

# Use a two-stage link
#
LDFLAGS		+= -r -d

# Source directories
#
SRCDIRS		+= drivers/linux
SRCDIRS		+= interface/linux
NON_AUTO_SRCS	+= interface/linux/linux_api.c

# Media types
#
NON_AUTO_MEDIA = linux

# Compiler flags for building host API wrapper
#
LINUX_CFLAGS	+= -Os -idirafter include -DSYMBOL_PREFIX=$(SYMBOL_PREFIX)

# Check for libslirp
#
LIBSLIRP_TEST = $(CC) $(LINUX_CFLAGS) -x c /dev/null -nostartfiles \
		      -include slirp/libslirp.h -lslirp \
		      -o /dev/null >/dev/null 2>&1
WITH_LIBSLIRP	:= $(shell $(LIBSLIRP_TEST) && $(ECHO) yes)
ifneq ($(WITH_LIBSLIRP),)
LINUX_CFLAGS	+= -DHAVE_LIBSLIRP
LINUX_LIBS	+= -lslirp
endif

# Host API wrapper
#
$(BIN)/linux_api.o : interface/linux/linux_api.c include/ipxe/linux_api.h \
		     include/ipxe/slirp.h $(MAKEDEPS)
	$(QM)$(ECHO) "  [BUILD] $@"
	$(Q)$(CC) $(LINUX_CFLAGS) $(WORKAROUND_CFLAGS) -o $@ -c $<

# Rule to generate final binary
#
$(BIN)/%.linux : $(BIN)/%.linux.tmp $(BIN)/linux_api.o
	$(QM)$(ECHO) "  [FINISH] $@"
	$(Q)$(CC) $(LINUX_CFLAGS) $(WORKAROUND_CFLAGS) -o $@ $^ $(LINUX_LIBS)