new makefile works

This commit is contained in:
Yanyan Jiang 2017-05-21 11:48:42 -04:00
parent ec6f9cdbe2
commit 86d5df015d
9 changed files with 17 additions and 15 deletions

View File

@ -5,8 +5,8 @@ AM_HOME ?= $(shell pwd)
.PHONY: all clean
all:
@cd am && build ARCH=$(ARCH)
@cd klib && build ARCH=$(ARCH)
@cd am && make ARCH=$(ARCH)
@cd klib && make ARCH=$(ARCH)
clean:
@cd am && make clean

View File

@ -1,4 +1,4 @@
.DEFAULTGOAL = app
.DEFAULT_GOAL = app
$(info Building $(NAME) [$(ARCH)])
include $(AM_HOME)/Makefile.check
@ -15,8 +15,7 @@ include $(AM_HOME)/Makefile.compile
.PHONY: app clean
app: $(OBJS)
@cd $(AM_HOME) && make ARCH=$(ARCH)
@$(AM_HOME)/am/arch/$(ARHC)/img/build $(BINARY) $(AM_HOME)/am/build/am-$(ARCH).a $(AM_HOME)/klib/build/klib-$(ARCH).a $(OBJS)
@echo "Hello"
@$(AM_HOME)/am/arch/$(ARCH)/img/build $(BINARY) $(AM_HOME)/am/build/am-$(ARCH).a $(AM_HOME)/klib/build/klib-$(ARCH).a $(OBJS)
clean:
rm -rf $(APP_DIR)/build/

View File

@ -1,4 +1,5 @@
ifneq ($(MAKECMDGOALS),clean)
ifndef ARCH
$(error "ARCH must be defined")
$(error variable ARCH must be defined)
endif
endif

View File

@ -14,7 +14,6 @@ include $(AM_HOME)/Makefile.compile
.PHONY: lib
lib: $(ARCHIVE)
@echo "Done"
$(ARCHIVE): $(OBJS)
ar rcs $(ARCHIVE) $(OBJS)

View File

@ -1,3 +1,3 @@
NAME = am
SRCS = $(shell find -L ./arch/$(ARCH)/ -name "*.c" -o -name "*.cpp" -o -name "*.S")
SRCS = $(shell find -L ./arch/$(ARCH)/src/ -name "*.c" -o -name "*.cpp" -o -name "*.S")
include $(AM_HOME)/Makefile.lib

View File

@ -1,6 +1,6 @@
#!/bin/bash
DIR=./am/arch/mips32-minimal/img
DIR=${AM_HOME}/am/arch/mips32-minimal/img
DEST=$1
shift

View File

@ -1,6 +1,6 @@
#!/bin/bash
DIR=./am/arch/mips32-npc/img
DIR=${AM_HOME}/am/arch/mips32-npc/img
DEST=$1
shift

View File

@ -1,10 +1,10 @@
#!/bin/bash
DIR=./am/arch/x86-qemu/img
DIR=${AM_HOME}/am/arch/x86-qemu/img
DEST=$1
shift
ld -melf_i386 -Ttext 0x00100000 -o ./build/kernel.o --start-group $@ --end-group
bash -c "cd $DIR/boot && make"
cat "$DIR/boot/mbr" ./build/kernel.o > ${DEST}
ld -melf_i386 -Ttext 0x00100000 -o ${DEST}.o --start-group $@ --end-group && \
bash -c "cd $DIR/boot && make" && \
cat "$DIR/boot/mbr" ${DEST}.o > ${DEST}

3
apps/litenes/Makefile Normal file
View File

@ -0,0 +1,3 @@
NAME = litenes
SRCS = $(shell find -L ./src/ -name "*.c" -o -name "*.cpp" -o -name "*.S")
include $(AM_HOME)/Makefile.app