2016-05-07 14:59:40 +00:00
|
|
|
|
|
|
|
AS=gcc
|
|
|
|
CC=gcc
|
|
|
|
CXX=g++
|
|
|
|
LD=ld
|
|
|
|
|
|
|
|
FLAGS = -mno-sse -DIDT_DISPATCH=$(IDT_DISPATCH) -ffreestanding -m32 -Werror -Wall -iquote include -iquote lists -O3 -g
|
|
|
|
ASFLAGS = $(FLAGS)
|
|
|
|
CFLAGS = $(FLAGS)
|
|
|
|
CXXFLAGS = $(FLAGS) -std=c++14 -fno-rtti -fno-exceptions -fno-leading-underscore -fno-use-cxa-atexit -nostdlib -fno-builtin
|
|
|
|
|
2016-05-07 17:45:04 +00:00
|
|
|
ARTIFACT = program
|
2016-05-07 14:59:40 +00:00
|
|
|
|
|
|
|
SRCS = $(shell find -regextype egrep -regex '.*/.*\.(cpp|S|c)')
|
|
|
|
OBJS = $(addsuffix .o, $(notdir $(basename $(SRCS))))
|
|
|
|
|
|
|
|
LIBGCC = $(shell gcc -m32 -print-libgcc-file-name)
|
|
|
|
|
|
|
|
all: $(ARTIFACT)
|
|
|
|
|
|
|
|
$(ARTIFACT): $(OBJS)
|
2016-05-07 17:45:04 +00:00
|
|
|
$(LD) -Tlinker.ld -o $(ARTIFACT) $(addprefix obj/, $^) $(LIBGCC)
|
2016-05-07 14:59:40 +00:00
|
|
|
|
|
|
|
%.o: %.cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -c -o obj/$@ $<
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(ASFLAGS) -c -o obj/$@ $<
|
|
|
|
|
|
|
|
%.o: %.S
|
|
|
|
$(AS) $(CFLAGS) -c -o obj/$@ $<
|
|
|
|
|
|
|
|
%.o: src/%.cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -c -o obj/$@ $<
|
|
|
|
|
|
|
|
%.o: src/%.c
|
|
|
|
$(CC) $(ASFLAGS) -c -o obj/$@ $<
|
|
|
|
|
|
|
|
%.o: src/%.S
|
|
|
|
$(AS) $(CFLAGS) -c -o obj/$@ $<
|
|
|
|
|
2016-05-07 17:45:04 +00:00
|
|
|
deploy: $(ARTIFACT)
|
2016-05-07 14:59:40 +00:00
|
|
|
cp $(ARTIFACT) /srv/tftp/$(ARTIFACT)
|