4fb6ae281ac53357460cde4c5062d4876dc7e5ab
[tpg/acess2.git] / AcessNative / ld-acess.so_src / Makefile
1 #
2 #
3
4 ifeq ($(PLATFORM),)
5         PLATFORM := lin
6 endif
7
8 OBJ := main.o syscalls.o request.o binary.o memory.o
9 OBJ += elf.o
10 OBJ := $(addsuffix .$(PLATFORM),$(OBJ))
11
12 ifeq ($(PLATFORM),win)
13         BIN := ../ld-acess.exe
14 endif
15 ifeq ($(PLATFORM),lin)
16         BIN := ../ld-acess
17         LD += -m elf_i386
18 endif
19
20 CFLAGS += -Wall -Werror -g -m32
21
22 .PHONY: all clean
23
24 all: $(BIN)
25
26 clean:
27         $(RM) $(BIN) $(OBJ)
28
29 $(BIN): link.ld.$(PLATFORM) $(OBJ)
30 #       $(LD) -g -o $@ $(OBJ) -T link.ld.$(PLATFORM)
31         $(CC) -g -o $@ $(OBJ) -m32 -Wl,-T,link.ld.$(PLATFORM)
32
33 %.o.$(PLATFORM): %.c
34         $(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS)
35
36 # Modify the default makefile to put the executable at 1MB instead
37 link.ld.lin:
38         $(LD) --verbose | awk '{ if( substr($$0,0,5) == "====="){ bPrint = !bPrint; } else { if(bPrint){ print $$0;} } }' | sed 's/\b0x0[08][0-9]*\b/0x00100000/g' > $@
39

UCC git Repository :: git.ucc.asn.au