aboutsummaryrefslogtreecommitdiffstats
path: root/com32/elflink/modules/MCONFIG
blob: 18845877882adc014d5d6959553498c3d710523c (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
52
53
54
55
56
57
58
59
60
61
62
## -*- makefile -*- -------------------------------------------------------
##   
##   Copyright 2008 H. Peter Anvin - All Rights Reserved
##
##   This program is free software; you can redistribute it and/or modify
##   it under the terms of the GNU General Public License as published by
##   the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
##   Boston MA 02110-1301, USA; either version 2 of the License, or
##   (at your option) any later version; incorporated herein by reference.
##
## -----------------------------------------------------------------------

##
## COM32 common configurables
##

include $(topdir)/MCONFIG

GCCOPT := $(call gcc_ok,-std=gnu99,) \
	  $(call gcc_ok,-m32,) \
	  $(call gcc_ok,-fno-stack-protector,) \
	  -mregparm=3 -DREGPARM=3 -march=i386 -Os

com32 = $(topdir)/com32

CFLAGS     = $(GCCOPT) -W -Wall -march=i386 \
	     -fomit-frame-pointer -D__COM32__ -DDYNAMIC_MODULE \
	     -nostdinc -iwithprefix include \
	     -I$(com32)/libutil/include -I$(com32)/include
SFLAGS     = $(GCCOPT) -D__COM32__ -march=i386
LDFLAGS    = -m elf_i386 -shared -T $(com32)/lib/elf32.ld
LIBGCC    := $(shell $(CC) $(GCCOPT) --print-libgcc)

LNXCFLAGS  = -I$(com32)/libutil/include -W -Wall -O -g -D_GNU_SOURCE
LNXSFLAGS  = -g
LNXLDFLAGS = -g

.SUFFIXES: .lss .c .o .dyn

.PRECIOUS: %.o
%.o: %.S
	$(CC) $(SFLAGS) -c -o $@ $<

.PRECIOUS: %.o
%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $<
	
.PRECIOUS: %.dyn
%.dyn: %.o $(LIBS)
	$(LD) $(LDFLAGS) -o $@ $^

.PRECIOUS: %.lo
%.lo: %.S
	$(CC) $(LNXSFLAGS) -c -o $@ $<

.PRECIOUS: %.lo
%.lo: %.c
	$(CC) $(LNXCFLAGS) -c -o $@ $<

.PRECIOUS: %.lnx
%.lnx: %.lo $(LNXLIBS)
	$(CC) $(LNXLDFLAGS) -o $@ $^