Kernel - Added a per-thread timer object to reduce malloc use
[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         LINKADDR := 0x200000
18 #       LD += -m elf_i386
19 endif
20
21 CFLAGS   += -Wall
22 CFLAGS   += -Werror
23 CFLAGS   += -g
24 CPPFLAGS += -DARCHDIR_is_x86_64=1
25 LDFLAGS  += -g -Wl,-T,obj-$(PLATFORM)/link.ld
26
27 DEPFILES  = $(filter %.o,$(OBJ))
28 DEPFILES := $(DEPFILES:%=%.dep)
29
30 .PHONY: all clean
31
32 all: $(BIN)
33
34 clean:
35         $(RM) $(BIN) $(OBJ) $(DEPFILES) obj-$(PLATFORM)/link.ld
36
37 $(BIN): obj-$(PLATFORM)/link.ld $(OBJ)
38         $(CC) $(LDFLAGS) -o $@ $(OBJ)
39
40 obj-$(PLATFORM)/%.o: %.c
41         @mkdir -p $(dir $@)
42         @echo [CC] -o $@
43         @$(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS)
44         @$(CC) -M $(CPPFLAGS) -MT $@ -o [email protected] $<
45
46 # Modify the default makefile to put the executable at 1MB instead
47 obj-lin/link.ld:
48         @mkdir -p $(dir $@)
49         @echo "Making Linker Script ($@)"
50         $(LD) --verbose | awk '{ if( substr($$0,0,5) == "====="){ bPrint = !bPrint; } else { if(bPrint){ print $$0;} } }' | sed 's/\b0x[048][0-9]*\b/$(LINKADDR)/g' | sed 's/CONSTANT (MAXPAGESIZE)/0x1000/g' > $@
51
52 -include $(DEPFILES)
53

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