3 TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX)
5 gcc_ok = $(shell tmpf=$(TMPFILE); if gcc $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \
6 then echo $(1); else echo $(2); fi; rm -f $$tmpf)
8 GCCOPT := $(call gcc_ok,-m32,) $(call gcc_ok,-fno-stack-protector,)
17 STRIP = strip --strip-all -R .comment -R .note
20 # zlib and libpng configuration flags
21 LIBFLAGS = -DDYNAMIC_CRC_TABLE -DPNG_NO_CONSOLE_IO \
22 -DPNG_NO_WRITE_SUPPORTED \
23 -DPNG_NO_MNG_FEATURES \
24 -DPNG_NO_READ_tIME -DPNG_NO_WRITE_tIME
26 # We need some features in libpng which apparently aren't available in the
27 # fixed-point versions. It's OK, because we have to have a non-graphical
28 # fallback anyway, just use that on old machines...
29 # LIBFLAGS += -DPNG_NO_FLOATING_POINT_SUPPORTED
31 REQFLAGS = $(GCCOPT) -g -mregparm=3 -DREGPARM=3 -D__COM32__ -I. -I./sys -I../include
32 OPTFLAGS = -Os -march=i386 -falign-functions=0 -falign-jumps=0 \
33 -falign-labels=0 -ffast-math -fomit-frame-pointer
34 WARNFLAGS = -W -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winline
36 CFLAGS = -Wp,-MT,$@,-MD,$(dir $@).$(notdir $@).d $(OPTFLAGS) \
37 $(REQFLAGS) $(WARNFLAGS) $(LIBFLAGS)
38 LDFLAGS = -m elf32_i386
40 .SUFFIXES: .c .o .a .so .lo .i .S .s .ls .ss .lss
42 % : %.c # Cancel default rule
47 $(CC) $(CFLAGS) -c -o $@ $<
50 $(CC) $(CFLAGS) -E -o $@ $<
53 $(CC) $(CFLAGS) -S -o $@ $<
56 $(CC) $(CFLAGS) -D__ASSEMBLY__ -c -o $@ $<
59 $(CC) $(CFLAGS) -D__ASSEMBLY__ -E -o $@ $<
62 $(CC) $(CFLAGS) $(SOFLAGS) -D__ASSEMBLY__ -c -o $@ $<
65 $(CC) $(CFLAGS) $(SOFLAGS) -D__ASSEMBLY__ -E -o $@ $<
68 $(CC) $(CFLAGS) -x assembler -c -o $@ $<
71 $(CC) $(CFLAGS) $(SOFLAGS) -x assembler -c -o $@ $<
74 $(CC) $(CFLAGS) $(SOFLAGS) -c -o $@ $<
77 $(CC) $(CFLAGS) $(SOFLAGS) -S -o $@ $<