Move files out of root into core, dos, and utils
[syslinux.git] / extlinux / Makefile
blobdec8739692bdfde91127cbf1051ae8f26fd0bc36
1 TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX)
2 CC = gcc
4 gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) ../dummy.c -o $$tmpf 2>/dev/null; \
5 then echo '$(1)'; else echo '$(2)'; fi; rm -f $$tmpf)
7 comma := ,
8 LDHASH := $(call gcc_ok,-Wl$(comma)--hash-style=both,)
10 OPTFLAGS = -g -Os
11 INCLUDES = -I. -I.. -I../libinstaller
12 CFLAGS = -W -Wall -Wno-sign-compare -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES)
13 LDFLAGS = $(LDHASH) # -s
15 SRCS = main.c ../libinstaller/setadv.c \
16 ../core/extlinux_bss_bin.c ../core/extlinux_sys_bin.c
17 OBJS = $(patsubst %.c,%.o,$(notdir $(SRCS)))
19 .SUFFIXES: .c .o .i .s .S
21 VPATH = .:../libinstaller:../core
23 all: installer
25 tidy dist:
26 -rm -f *.o *.i *.s *.a .*.d
28 clean: tidy
29 -rm -f extlinux
31 spotless: clean
32 -rm -f *~
34 installer: extlinux
36 extlinux: $(OBJS)
37 $(CC) $(LDFLAGS) -o $@ $^
39 %.o: %.c
40 $(CC) -Wp,-MT,$@,-MMD,.$@.d $(CFLAGS) -c -o $@ $<
41 %.i: %.c
42 $(CC) $(CFLAGS) -E -o $@ $<
43 %.s: %.c
44 $(CC) $(CFLAGS) -S -o $@ $<
46 -include .*.d