1 ## -*- makefile -*- -------------------------------------------------------
3 ## Copyright 2008 H. Peter Anvin - All Rights Reserved
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
8 ## Boston MA 02110-1301, USA; either version 2 of the License, or
9 ## (at your option) any later version; incorporated herein by reference.
11 ## -----------------------------------------------------------------------
14 ## COM32 common configurables
17 include $(topdir)/MCONFIG
19 GCCOPT := $(call gcc_ok,-std=gnu99,) \
20 $(call gcc_ok,-m32,) \
21 $(call gcc_ok,-fno-stack-protector,) \
22 -mregparm=3 -DREGPARM=3 -march=i386 -Os
24 com32 = $(topdir)/com32
26 CFLAGS = $(GCCOPT) -W -Wall -march=i386 \
27 -fomit-frame-pointer -D__COM32__ \
28 -nostdinc -iwithprefix include \
29 -I$(com32)/libutil/include -I$(com32)/include
30 SFLAGS = $(GCCOPT) -D__COM32__ -march=i386
31 LDFLAGS = -m elf_i386 -T $(com32)/lib/com32.ld
32 LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc)
34 LNXCFLAGS = -I$(com32)/libutil/include -W -Wall -O -g -D_GNU_SOURCE
38 C_LIBS = $(com32)/libutil/libutil_com.a $(com32)/lib/libcom32.a $(LIBGCC)
39 C_LNXLIBS = $(com32)/libutil/libutil_lnx.a
41 .SUFFIXES: .lss .c .lo .o .elf .c32 .lnx
45 $(CC) $(SFLAGS) -c -o $@ $<
49 $(CC) $(CFLAGS) -c -o $@ $<
52 %.elf: %.o $(LIBS) $(C_LIBS)
53 $(LD) $(LDFLAGS) -o $@ $^
57 $(CC) $(LNXSFLAGS) -c -o $@ $<
61 $(CC) $(LNXCFLAGS) -c -o $@ $<
64 %.lnx: %.lo $(LNXLIBS) $(C_LNXLIBS)
65 $(CC) $(LNXCFLAGS) -o $@ $^
68 $(OBJCOPY) -O binary $< $@