Subversion Repositories Kolibri OS

Rev

Rev 9758 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
9758 maxcodehac 1
# static linking
2
 
6071 serge 3
CC = kos32-gcc
4
LD = kos32-ld
5
 
9759 maxcodehac 6
CONTRIB_DIR = $(abspath ../../..)
7
SDK_DIR = $(CONTRIB_DIR)/sdk
6071 serge 8
 
9758 maxcodehac 9
CFLAGS = -c -fno-ident -O2 -fomit-frame-pointer -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32
6866 serge 10
LDFLAGS = -static -Tapp-static.lds
6071 serge 11
 
9758 maxcodehac 12
INCLUDES = -I $(SDK_DIR)/sources/newlib/libc/include
13
LIBPATH = -L $(SDK_DIR)/lib
6071 serge 14
 
9758 maxcodehac 15
SOURCES = hello.c
6071 serge 16
OBJECTS =  $(patsubst %.c, %.o, $(SOURCES))
17
 
18
default: hello
19
 
20
hello: $(OBJECTS) Makefile.static
9758 maxcodehac 21
	$(LD) $(LDFLAGS) $(LIBPATH) -o hello $(OBJECTS) -lc -lgcc -lc
6071 serge 22
	objcopy hello -O binary
23
 
24
%.o : %.c Makefile.static $(SOURCES)
25
	$(CC) $(CFLAGS) $(INCLUDES) -o $@ $<