AcessNative/ld-acess - Fixed forgetting to update for API changes
[tpg/acess2.git] / AcessNative / ld-acess_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 exports.o
9 OBJ += elf.o elf_load.o
10 OBJ := $(addprefix obj-$(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 DEPFILES  = $(filter %.o,$(OBJ))
23 DEPFILES := $(DEPFILES:%=%.dep)
24
25 .PHONY: all clean
26
27 all: $(BIN)
28
29 clean:
30         $(RM) $(BIN) $(OBJ) $(DEPFILES)
31
32 $(BIN): obj-$(PLATFORM)/link.ld $(OBJ)
33         $(CC) -g -o $@ $(OBJ) -m32 -Wl,-T,obj-$(PLATFORM)/link.ld
34
35 obj-$(PLATFORM)/%.o: %.c
36         @mkdir -p $(dir $@)
37         @echo [CC] -o $@
38         @$(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS)
39         @$(CC) -M $(CPPFLAGS) -MT $@ -o [email protected] $<
40
41 # Modify the default makefile to put the executable at 1MB instead
42 obj-lin/link.ld:
43         @mkdir -p $(dir $@)
44         @echo "Making Linker Script ($@)"
45         @$(LD) --verbose | awk '{ if( substr($$0,0,5) == "====="){ bPrint = !bPrint; } else { if(bPrint){ print $$0;} } }' | sed 's/\b0x0[08][0-9]*\b/0x00100000/g' > $@
46
47 -include $(DEPFILES)
48

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