summaryrefslogtreecommitdiff
path: root/Source/UnixUserland/Makefile
blob: 44fa29fbb91e60b57c80fe42976e1f11a380804d (plain) (blame)
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
.PHONY: clean, mrproper

CC = gcc
CCFLAGS = -nostdlib -nostartfiles -nodefaultlibs -fno-builtin -fno-stack-protector -Wall -Wextra -Werror -I../../Ports/newlib-1.15.0/newlib/libc/include

LD = ld
LDFLAGS = -r

OutFile = MelonUnix.o
Objects = _exit.o \
		  _start.o \
		  close.o \
		  environ.o \
		  execve.o \
		  fork.o \
		  fstat.o \
		  getpid.o \
		  isatty.o \
		  kill.o \
		  link.o \
		  lseek.o \
		  open.o \
		  read.o \
		  sbrk.o \
		  stat.o \
		  times.o \
		  unlink.o \
		  wait.o \
		  write.o

all: $(OutFile)
	echo "* Done with $(OutFile)."

rebuild: mrproper all

$(OutFile): $(Objects)
	echo "* Linking executable : $(OutFile)..."
	$(LD) $(LDFLAGS) -o $(OutFile) $^

%.o: %.c
	echo "* Compiling $<..."
	$(CC) -c $< -o $@ $(CFLAGS)
	
clean:
	echo "* Removing object files..."
	rm -rf $(Objects)

mrproper: clean
	echo "* Removing executable: $(OutFile)"
	rm -rf $(OutFile)