diff --git a/Makefile b/Makefile index 6a72399..4c5fa9c 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,8 @@ SOURCE_FILES := $(shell find src/kernel -name *.c -or -name *.asm -or -name *.s) OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) -USER_PROGRAMS := $(shell tree -d -L 1 -i --noreport src/userland/ | tail -n+2) -USER_PROGRAM_NAMES := $(USER_PROGRAMS:%=user/%) -USER_PROGRAM_FILES := $(USER_PROGRAMS:%=initrd/%) -run: build initrd hlib $(USER_PROGRAM_NAMES) $(IMAGE_FILE) +run: build initrd hlib userPrograms $(IMAGE_FILE) @echo "starting qemu" @$(EMU) $(EMUFLAGS) @@ -67,14 +64,12 @@ @mkdir -p $(dir $@) @$(CC) $(CCFLAGS) -r $< -o $@ -user/%: src/userland/% - @echo "compiling userspace program $<" - @make -C $< +userPrograms: + @make --silent -C src/userland hlib: - @echo "compiling userspace honey-os library" - @make -C src/hlib + @make --silent -C src/hlib clean: @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) initrd src/userland/*/build + @rm -r $(BUILD_FOLDER) initrd src/userland/build diff --git a/Makefile b/Makefile index 6a72399..4c5fa9c 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,8 @@ SOURCE_FILES := $(shell find src/kernel -name *.c -or -name *.asm -or -name *.s) OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) -USER_PROGRAMS := $(shell tree -d -L 1 -i --noreport src/userland/ | tail -n+2) -USER_PROGRAM_NAMES := $(USER_PROGRAMS:%=user/%) -USER_PROGRAM_FILES := $(USER_PROGRAMS:%=initrd/%) -run: build initrd hlib $(USER_PROGRAM_NAMES) $(IMAGE_FILE) +run: build initrd hlib userPrograms $(IMAGE_FILE) @echo "starting qemu" @$(EMU) $(EMUFLAGS) @@ -67,14 +64,12 @@ @mkdir -p $(dir $@) @$(CC) $(CCFLAGS) -r $< -o $@ -user/%: src/userland/% - @echo "compiling userspace program $<" - @make -C $< +userPrograms: + @make --silent -C src/userland hlib: - @echo "compiling userspace honey-os library" - @make -C src/hlib + @make --silent -C src/hlib clean: @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) initrd src/userland/*/build + @rm -r $(BUILD_FOLDER) initrd src/userland/build diff --git a/src/userland/Makefile b/src/userland/Makefile new file mode 100644 index 0000000..24e4916 --- /dev/null +++ b/src/userland/Makefile @@ -0,0 +1,41 @@ +CC = i686-elf-gcc +CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero +LD = i686-elf-ld +LD_FLAGS = -z max-page-size=0x1000 -T link.ld --no-warn-rwx-segment +AS = nasm +ASFlAGS = -felf32 + +SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) +OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) + +PROGRAM_NAMES := $(shell ls -d */ | sed "s/\/$$//" | sed "s|build||") +PROGRAMS := $(PROGRAM_NAMES:%=../../initrd/%) + +all: $(PROGRAMS) + +.SUFFIXES: + +define MAKE_PROGRAM + +../../initrd/$(1): $(2) + @echo "linking $(1) from $$^" + @$(LD) $(LD_FLAGS) -o $$@ $$^ + +build/$(1)/%.c.o: $(1)/%.c + @echo "compiling '$$<' to '$$@' for $(1)" + @mkdir -p $$(dir $$@) + @$(CC) $(CCFLAGS) $$< -o $$@ -I $(1)/include + +endef + +$(foreach NAME, $(PROGRAM_NAMES), $(eval $(call MAKE_PROGRAM,$(NAME),$(shell find $(NAME) -name "*.c" | sed "s|$$|.o|" | sed "s|^|build/|")))) + + +# $(shell find $(subst user/,,$@) -name "*.c" | sed "s?/\([^/]*\)?/build/\1?") +#user/%: $$(shell echo "test") +# NAME=$$(echo $@ | sed "s?user/??"); \ +# SOURCES=$$(find $$NAME -name "*.c"); \ +# OBJS=$$(echo $$SOURCES | sed "s|$$|.o|" | sed "s|^|build/|"); \ +# make $$OBJS;\ +# echo "linking $@ $<";\ +# $(LD) $(LD_FLAGS) -I include$$NAME -o ../../initrd/$$NAME diff --git a/Makefile b/Makefile index 6a72399..4c5fa9c 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,8 @@ SOURCE_FILES := $(shell find src/kernel -name *.c -or -name *.asm -or -name *.s) OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) -USER_PROGRAMS := $(shell tree -d -L 1 -i --noreport src/userland/ | tail -n+2) -USER_PROGRAM_NAMES := $(USER_PROGRAMS:%=user/%) -USER_PROGRAM_FILES := $(USER_PROGRAMS:%=initrd/%) -run: build initrd hlib $(USER_PROGRAM_NAMES) $(IMAGE_FILE) +run: build initrd hlib userPrograms $(IMAGE_FILE) @echo "starting qemu" @$(EMU) $(EMUFLAGS) @@ -67,14 +64,12 @@ @mkdir -p $(dir $@) @$(CC) $(CCFLAGS) -r $< -o $@ -user/%: src/userland/% - @echo "compiling userspace program $<" - @make -C $< +userPrograms: + @make --silent -C src/userland hlib: - @echo "compiling userspace honey-os library" - @make -C src/hlib + @make --silent -C src/hlib clean: @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) initrd src/userland/*/build + @rm -r $(BUILD_FOLDER) initrd src/userland/build diff --git a/src/userland/Makefile b/src/userland/Makefile new file mode 100644 index 0000000..24e4916 --- /dev/null +++ b/src/userland/Makefile @@ -0,0 +1,41 @@ +CC = i686-elf-gcc +CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero +LD = i686-elf-ld +LD_FLAGS = -z max-page-size=0x1000 -T link.ld --no-warn-rwx-segment +AS = nasm +ASFlAGS = -felf32 + +SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) +OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) + +PROGRAM_NAMES := $(shell ls -d */ | sed "s/\/$$//" | sed "s|build||") +PROGRAMS := $(PROGRAM_NAMES:%=../../initrd/%) + +all: $(PROGRAMS) + +.SUFFIXES: + +define MAKE_PROGRAM + +../../initrd/$(1): $(2) + @echo "linking $(1) from $$^" + @$(LD) $(LD_FLAGS) -o $$@ $$^ + +build/$(1)/%.c.o: $(1)/%.c + @echo "compiling '$$<' to '$$@' for $(1)" + @mkdir -p $$(dir $$@) + @$(CC) $(CCFLAGS) $$< -o $$@ -I $(1)/include + +endef + +$(foreach NAME, $(PROGRAM_NAMES), $(eval $(call MAKE_PROGRAM,$(NAME),$(shell find $(NAME) -name "*.c" | sed "s|$$|.o|" | sed "s|^|build/|")))) + + +# $(shell find $(subst user/,,$@) -name "*.c" | sed "s?/\([^/]*\)?/build/\1?") +#user/%: $$(shell echo "test") +# NAME=$$(echo $@ | sed "s?user/??"); \ +# SOURCES=$$(find $$NAME -name "*.c"); \ +# OBJS=$$(echo $$SOURCES | sed "s|$$|.o|" | sed "s|^|build/|"); \ +# make $$OBJS;\ +# echo "linking $@ $<";\ +# $(LD) $(LD_FLAGS) -I include$$NAME -o ../../initrd/$$NAME diff --git a/src/userland/crashTest/Makefile b/src/userland/crashTest/Makefile deleted file mode 100644 index 9be876f..0000000 --- a/src/userland/crashTest/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/crashTest: $(OBJS) ../../../build/hlib.o - @echo "linking user programm crash test" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/Makefile b/Makefile index 6a72399..4c5fa9c 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,8 @@ SOURCE_FILES := $(shell find src/kernel -name *.c -or -name *.asm -or -name *.s) OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) -USER_PROGRAMS := $(shell tree -d -L 1 -i --noreport src/userland/ | tail -n+2) -USER_PROGRAM_NAMES := $(USER_PROGRAMS:%=user/%) -USER_PROGRAM_FILES := $(USER_PROGRAMS:%=initrd/%) -run: build initrd hlib $(USER_PROGRAM_NAMES) $(IMAGE_FILE) +run: build initrd hlib userPrograms $(IMAGE_FILE) @echo "starting qemu" @$(EMU) $(EMUFLAGS) @@ -67,14 +64,12 @@ @mkdir -p $(dir $@) @$(CC) $(CCFLAGS) -r $< -o $@ -user/%: src/userland/% - @echo "compiling userspace program $<" - @make -C $< +userPrograms: + @make --silent -C src/userland hlib: - @echo "compiling userspace honey-os library" - @make -C src/hlib + @make --silent -C src/hlib clean: @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) initrd src/userland/*/build + @rm -r $(BUILD_FOLDER) initrd src/userland/build diff --git a/src/userland/Makefile b/src/userland/Makefile new file mode 100644 index 0000000..24e4916 --- /dev/null +++ b/src/userland/Makefile @@ -0,0 +1,41 @@ +CC = i686-elf-gcc +CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero +LD = i686-elf-ld +LD_FLAGS = -z max-page-size=0x1000 -T link.ld --no-warn-rwx-segment +AS = nasm +ASFlAGS = -felf32 + +SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) +OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) + +PROGRAM_NAMES := $(shell ls -d */ | sed "s/\/$$//" | sed "s|build||") +PROGRAMS := $(PROGRAM_NAMES:%=../../initrd/%) + +all: $(PROGRAMS) + +.SUFFIXES: + +define MAKE_PROGRAM + +../../initrd/$(1): $(2) + @echo "linking $(1) from $$^" + @$(LD) $(LD_FLAGS) -o $$@ $$^ + +build/$(1)/%.c.o: $(1)/%.c + @echo "compiling '$$<' to '$$@' for $(1)" + @mkdir -p $$(dir $$@) + @$(CC) $(CCFLAGS) $$< -o $$@ -I $(1)/include + +endef + +$(foreach NAME, $(PROGRAM_NAMES), $(eval $(call MAKE_PROGRAM,$(NAME),$(shell find $(NAME) -name "*.c" | sed "s|$$|.o|" | sed "s|^|build/|")))) + + +# $(shell find $(subst user/,,$@) -name "*.c" | sed "s?/\([^/]*\)?/build/\1?") +#user/%: $$(shell echo "test") +# NAME=$$(echo $@ | sed "s?user/??"); \ +# SOURCES=$$(find $$NAME -name "*.c"); \ +# OBJS=$$(echo $$SOURCES | sed "s|$$|.o|" | sed "s|^|build/|"); \ +# make $$OBJS;\ +# echo "linking $@ $<";\ +# $(LD) $(LD_FLAGS) -I include$$NAME -o ../../initrd/$$NAME diff --git a/src/userland/crashTest/Makefile b/src/userland/crashTest/Makefile deleted file mode 100644 index 9be876f..0000000 --- a/src/userland/crashTest/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/crashTest: $(OBJS) ../../../build/hlib.o - @echo "linking user programm crash test" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/hid/Makefile b/src/userland/hid/Makefile deleted file mode 100644 index 81bcd9d..0000000 --- a/src/userland/hid/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name "*.c" -or -name "*.asm" -or -name "*.s") -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = hid - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/Makefile b/Makefile index 6a72399..4c5fa9c 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,8 @@ SOURCE_FILES := $(shell find src/kernel -name *.c -or -name *.asm -or -name *.s) OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) -USER_PROGRAMS := $(shell tree -d -L 1 -i --noreport src/userland/ | tail -n+2) -USER_PROGRAM_NAMES := $(USER_PROGRAMS:%=user/%) -USER_PROGRAM_FILES := $(USER_PROGRAMS:%=initrd/%) -run: build initrd hlib $(USER_PROGRAM_NAMES) $(IMAGE_FILE) +run: build initrd hlib userPrograms $(IMAGE_FILE) @echo "starting qemu" @$(EMU) $(EMUFLAGS) @@ -67,14 +64,12 @@ @mkdir -p $(dir $@) @$(CC) $(CCFLAGS) -r $< -o $@ -user/%: src/userland/% - @echo "compiling userspace program $<" - @make -C $< +userPrograms: + @make --silent -C src/userland hlib: - @echo "compiling userspace honey-os library" - @make -C src/hlib + @make --silent -C src/hlib clean: @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) initrd src/userland/*/build + @rm -r $(BUILD_FOLDER) initrd src/userland/build diff --git a/src/userland/Makefile b/src/userland/Makefile new file mode 100644 index 0000000..24e4916 --- /dev/null +++ b/src/userland/Makefile @@ -0,0 +1,41 @@ +CC = i686-elf-gcc +CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero +LD = i686-elf-ld +LD_FLAGS = -z max-page-size=0x1000 -T link.ld --no-warn-rwx-segment +AS = nasm +ASFlAGS = -felf32 + +SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) +OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) + +PROGRAM_NAMES := $(shell ls -d */ | sed "s/\/$$//" | sed "s|build||") +PROGRAMS := $(PROGRAM_NAMES:%=../../initrd/%) + +all: $(PROGRAMS) + +.SUFFIXES: + +define MAKE_PROGRAM + +../../initrd/$(1): $(2) + @echo "linking $(1) from $$^" + @$(LD) $(LD_FLAGS) -o $$@ $$^ + +build/$(1)/%.c.o: $(1)/%.c + @echo "compiling '$$<' to '$$@' for $(1)" + @mkdir -p $$(dir $$@) + @$(CC) $(CCFLAGS) $$< -o $$@ -I $(1)/include + +endef + +$(foreach NAME, $(PROGRAM_NAMES), $(eval $(call MAKE_PROGRAM,$(NAME),$(shell find $(NAME) -name "*.c" | sed "s|$$|.o|" | sed "s|^|build/|")))) + + +# $(shell find $(subst user/,,$@) -name "*.c" | sed "s?/\([^/]*\)?/build/\1?") +#user/%: $$(shell echo "test") +# NAME=$$(echo $@ | sed "s?user/??"); \ +# SOURCES=$$(find $$NAME -name "*.c"); \ +# OBJS=$$(echo $$SOURCES | sed "s|$$|.o|" | sed "s|^|build/|"); \ +# make $$OBJS;\ +# echo "linking $@ $<";\ +# $(LD) $(LD_FLAGS) -I include$$NAME -o ../../initrd/$$NAME diff --git a/src/userland/crashTest/Makefile b/src/userland/crashTest/Makefile deleted file mode 100644 index 9be876f..0000000 --- a/src/userland/crashTest/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/crashTest: $(OBJS) ../../../build/hlib.o - @echo "linking user programm crash test" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/hid/Makefile b/src/userland/hid/Makefile deleted file mode 100644 index 81bcd9d..0000000 --- a/src/userland/hid/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name "*.c" -or -name "*.asm" -or -name "*.s") -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = hid - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/ioManager/Makefile b/src/userland/ioManager/Makefile deleted file mode 100644 index 0b0ac8e..0000000 --- a/src/userland/ioManager/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/ioManager: $(OBJS) ../../../build/hlib.o - @echo "linking user program io manager" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/Makefile b/Makefile index 6a72399..4c5fa9c 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,8 @@ SOURCE_FILES := $(shell find src/kernel -name *.c -or -name *.asm -or -name *.s) OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) -USER_PROGRAMS := $(shell tree -d -L 1 -i --noreport src/userland/ | tail -n+2) -USER_PROGRAM_NAMES := $(USER_PROGRAMS:%=user/%) -USER_PROGRAM_FILES := $(USER_PROGRAMS:%=initrd/%) -run: build initrd hlib $(USER_PROGRAM_NAMES) $(IMAGE_FILE) +run: build initrd hlib userPrograms $(IMAGE_FILE) @echo "starting qemu" @$(EMU) $(EMUFLAGS) @@ -67,14 +64,12 @@ @mkdir -p $(dir $@) @$(CC) $(CCFLAGS) -r $< -o $@ -user/%: src/userland/% - @echo "compiling userspace program $<" - @make -C $< +userPrograms: + @make --silent -C src/userland hlib: - @echo "compiling userspace honey-os library" - @make -C src/hlib + @make --silent -C src/hlib clean: @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) initrd src/userland/*/build + @rm -r $(BUILD_FOLDER) initrd src/userland/build diff --git a/src/userland/Makefile b/src/userland/Makefile new file mode 100644 index 0000000..24e4916 --- /dev/null +++ b/src/userland/Makefile @@ -0,0 +1,41 @@ +CC = i686-elf-gcc +CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero +LD = i686-elf-ld +LD_FLAGS = -z max-page-size=0x1000 -T link.ld --no-warn-rwx-segment +AS = nasm +ASFlAGS = -felf32 + +SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) +OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) + +PROGRAM_NAMES := $(shell ls -d */ | sed "s/\/$$//" | sed "s|build||") +PROGRAMS := $(PROGRAM_NAMES:%=../../initrd/%) + +all: $(PROGRAMS) + +.SUFFIXES: + +define MAKE_PROGRAM + +../../initrd/$(1): $(2) + @echo "linking $(1) from $$^" + @$(LD) $(LD_FLAGS) -o $$@ $$^ + +build/$(1)/%.c.o: $(1)/%.c + @echo "compiling '$$<' to '$$@' for $(1)" + @mkdir -p $$(dir $$@) + @$(CC) $(CCFLAGS) $$< -o $$@ -I $(1)/include + +endef + +$(foreach NAME, $(PROGRAM_NAMES), $(eval $(call MAKE_PROGRAM,$(NAME),$(shell find $(NAME) -name "*.c" | sed "s|$$|.o|" | sed "s|^|build/|")))) + + +# $(shell find $(subst user/,,$@) -name "*.c" | sed "s?/\([^/]*\)?/build/\1?") +#user/%: $$(shell echo "test") +# NAME=$$(echo $@ | sed "s?user/??"); \ +# SOURCES=$$(find $$NAME -name "*.c"); \ +# OBJS=$$(echo $$SOURCES | sed "s|$$|.o|" | sed "s|^|build/|"); \ +# make $$OBJS;\ +# echo "linking $@ $<";\ +# $(LD) $(LD_FLAGS) -I include$$NAME -o ../../initrd/$$NAME diff --git a/src/userland/crashTest/Makefile b/src/userland/crashTest/Makefile deleted file mode 100644 index 9be876f..0000000 --- a/src/userland/crashTest/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/crashTest: $(OBJS) ../../../build/hlib.o - @echo "linking user programm crash test" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/hid/Makefile b/src/userland/hid/Makefile deleted file mode 100644 index 81bcd9d..0000000 --- a/src/userland/hid/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name "*.c" -or -name "*.asm" -or -name "*.s") -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = hid - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/ioManager/Makefile b/src/userland/ioManager/Makefile deleted file mode 100644 index 0b0ac8e..0000000 --- a/src/userland/ioManager/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/ioManager: $(OBJS) ../../../build/hlib.o - @echo "linking user program io manager" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/keyboard/Makefile b/src/userland/keyboard/Makefile deleted file mode 100644 index 99ace25..0000000 --- a/src/userland/keyboard/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/keyboard: $(OBJS) ../../../build/hlib.o - @echo "linking user program PS/2 keyboard" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/Makefile b/Makefile index 6a72399..4c5fa9c 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,8 @@ SOURCE_FILES := $(shell find src/kernel -name *.c -or -name *.asm -or -name *.s) OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) -USER_PROGRAMS := $(shell tree -d -L 1 -i --noreport src/userland/ | tail -n+2) -USER_PROGRAM_NAMES := $(USER_PROGRAMS:%=user/%) -USER_PROGRAM_FILES := $(USER_PROGRAMS:%=initrd/%) -run: build initrd hlib $(USER_PROGRAM_NAMES) $(IMAGE_FILE) +run: build initrd hlib userPrograms $(IMAGE_FILE) @echo "starting qemu" @$(EMU) $(EMUFLAGS) @@ -67,14 +64,12 @@ @mkdir -p $(dir $@) @$(CC) $(CCFLAGS) -r $< -o $@ -user/%: src/userland/% - @echo "compiling userspace program $<" - @make -C $< +userPrograms: + @make --silent -C src/userland hlib: - @echo "compiling userspace honey-os library" - @make -C src/hlib + @make --silent -C src/hlib clean: @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) initrd src/userland/*/build + @rm -r $(BUILD_FOLDER) initrd src/userland/build diff --git a/src/userland/Makefile b/src/userland/Makefile new file mode 100644 index 0000000..24e4916 --- /dev/null +++ b/src/userland/Makefile @@ -0,0 +1,41 @@ +CC = i686-elf-gcc +CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero +LD = i686-elf-ld +LD_FLAGS = -z max-page-size=0x1000 -T link.ld --no-warn-rwx-segment +AS = nasm +ASFlAGS = -felf32 + +SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) +OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) + +PROGRAM_NAMES := $(shell ls -d */ | sed "s/\/$$//" | sed "s|build||") +PROGRAMS := $(PROGRAM_NAMES:%=../../initrd/%) + +all: $(PROGRAMS) + +.SUFFIXES: + +define MAKE_PROGRAM + +../../initrd/$(1): $(2) + @echo "linking $(1) from $$^" + @$(LD) $(LD_FLAGS) -o $$@ $$^ + +build/$(1)/%.c.o: $(1)/%.c + @echo "compiling '$$<' to '$$@' for $(1)" + @mkdir -p $$(dir $$@) + @$(CC) $(CCFLAGS) $$< -o $$@ -I $(1)/include + +endef + +$(foreach NAME, $(PROGRAM_NAMES), $(eval $(call MAKE_PROGRAM,$(NAME),$(shell find $(NAME) -name "*.c" | sed "s|$$|.o|" | sed "s|^|build/|")))) + + +# $(shell find $(subst user/,,$@) -name "*.c" | sed "s?/\([^/]*\)?/build/\1?") +#user/%: $$(shell echo "test") +# NAME=$$(echo $@ | sed "s?user/??"); \ +# SOURCES=$$(find $$NAME -name "*.c"); \ +# OBJS=$$(echo $$SOURCES | sed "s|$$|.o|" | sed "s|^|build/|"); \ +# make $$OBJS;\ +# echo "linking $@ $<";\ +# $(LD) $(LD_FLAGS) -I include$$NAME -o ../../initrd/$$NAME diff --git a/src/userland/crashTest/Makefile b/src/userland/crashTest/Makefile deleted file mode 100644 index 9be876f..0000000 --- a/src/userland/crashTest/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/crashTest: $(OBJS) ../../../build/hlib.o - @echo "linking user programm crash test" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/hid/Makefile b/src/userland/hid/Makefile deleted file mode 100644 index 81bcd9d..0000000 --- a/src/userland/hid/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name "*.c" -or -name "*.asm" -or -name "*.s") -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = hid - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/ioManager/Makefile b/src/userland/ioManager/Makefile deleted file mode 100644 index 0b0ac8e..0000000 --- a/src/userland/ioManager/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/ioManager: $(OBJS) ../../../build/hlib.o - @echo "linking user program io manager" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/keyboard/Makefile b/src/userland/keyboard/Makefile deleted file mode 100644 index 99ace25..0000000 --- a/src/userland/keyboard/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/keyboard: $(OBJS) ../../../build/hlib.o - @echo "linking user program PS/2 keyboard" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/link.ld b/src/userland/link.ld index cd5fb81..f9cdecc 100644 --- a/src/userland/link.ld +++ b/src/userland/link.ld @@ -1,7 +1,7 @@ OUTPUT_ARCH(i386) ENTRY(main) -INPUT( ../../../build/hlib.o) +INPUT( ../../build/hlib.o) SECTIONS { . = 0x80000000; diff --git a/Makefile b/Makefile index 6a72399..4c5fa9c 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,8 @@ SOURCE_FILES := $(shell find src/kernel -name *.c -or -name *.asm -or -name *.s) OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) -USER_PROGRAMS := $(shell tree -d -L 1 -i --noreport src/userland/ | tail -n+2) -USER_PROGRAM_NAMES := $(USER_PROGRAMS:%=user/%) -USER_PROGRAM_FILES := $(USER_PROGRAMS:%=initrd/%) -run: build initrd hlib $(USER_PROGRAM_NAMES) $(IMAGE_FILE) +run: build initrd hlib userPrograms $(IMAGE_FILE) @echo "starting qemu" @$(EMU) $(EMUFLAGS) @@ -67,14 +64,12 @@ @mkdir -p $(dir $@) @$(CC) $(CCFLAGS) -r $< -o $@ -user/%: src/userland/% - @echo "compiling userspace program $<" - @make -C $< +userPrograms: + @make --silent -C src/userland hlib: - @echo "compiling userspace honey-os library" - @make -C src/hlib + @make --silent -C src/hlib clean: @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) initrd src/userland/*/build + @rm -r $(BUILD_FOLDER) initrd src/userland/build diff --git a/src/userland/Makefile b/src/userland/Makefile new file mode 100644 index 0000000..24e4916 --- /dev/null +++ b/src/userland/Makefile @@ -0,0 +1,41 @@ +CC = i686-elf-gcc +CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero +LD = i686-elf-ld +LD_FLAGS = -z max-page-size=0x1000 -T link.ld --no-warn-rwx-segment +AS = nasm +ASFlAGS = -felf32 + +SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) +OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) + +PROGRAM_NAMES := $(shell ls -d */ | sed "s/\/$$//" | sed "s|build||") +PROGRAMS := $(PROGRAM_NAMES:%=../../initrd/%) + +all: $(PROGRAMS) + +.SUFFIXES: + +define MAKE_PROGRAM + +../../initrd/$(1): $(2) + @echo "linking $(1) from $$^" + @$(LD) $(LD_FLAGS) -o $$@ $$^ + +build/$(1)/%.c.o: $(1)/%.c + @echo "compiling '$$<' to '$$@' for $(1)" + @mkdir -p $$(dir $$@) + @$(CC) $(CCFLAGS) $$< -o $$@ -I $(1)/include + +endef + +$(foreach NAME, $(PROGRAM_NAMES), $(eval $(call MAKE_PROGRAM,$(NAME),$(shell find $(NAME) -name "*.c" | sed "s|$$|.o|" | sed "s|^|build/|")))) + + +# $(shell find $(subst user/,,$@) -name "*.c" | sed "s?/\([^/]*\)?/build/\1?") +#user/%: $$(shell echo "test") +# NAME=$$(echo $@ | sed "s?user/??"); \ +# SOURCES=$$(find $$NAME -name "*.c"); \ +# OBJS=$$(echo $$SOURCES | sed "s|$$|.o|" | sed "s|^|build/|"); \ +# make $$OBJS;\ +# echo "linking $@ $<";\ +# $(LD) $(LD_FLAGS) -I include$$NAME -o ../../initrd/$$NAME diff --git a/src/userland/crashTest/Makefile b/src/userland/crashTest/Makefile deleted file mode 100644 index 9be876f..0000000 --- a/src/userland/crashTest/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/crashTest: $(OBJS) ../../../build/hlib.o - @echo "linking user programm crash test" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/hid/Makefile b/src/userland/hid/Makefile deleted file mode 100644 index 81bcd9d..0000000 --- a/src/userland/hid/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name "*.c" -or -name "*.asm" -or -name "*.s") -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = hid - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/ioManager/Makefile b/src/userland/ioManager/Makefile deleted file mode 100644 index 0b0ac8e..0000000 --- a/src/userland/ioManager/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/ioManager: $(OBJS) ../../../build/hlib.o - @echo "linking user program io manager" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/keyboard/Makefile b/src/userland/keyboard/Makefile deleted file mode 100644 index 99ace25..0000000 --- a/src/userland/keyboard/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/keyboard: $(OBJS) ../../../build/hlib.o - @echo "linking user program PS/2 keyboard" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/link.ld b/src/userland/link.ld index cd5fb81..f9cdecc 100644 --- a/src/userland/link.ld +++ b/src/userland/link.ld @@ -1,7 +1,7 @@ OUTPUT_ARCH(i386) ENTRY(main) -INPUT( ../../../build/hlib.o) +INPUT( ../../build/hlib.o) SECTIONS { . = 0x80000000; diff --git a/src/userland/loader/Makefile b/src/userland/loader/Makefile deleted file mode 100644 index 2c52ec5..0000000 --- a/src/userland/loader/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/loader: $(OBJS) ../../../build/hlib.o - @echo "linking user program loader" - @$(LD) $(LD_FLAGS) -o ../../../initrd/loader $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/Makefile b/Makefile index 6a72399..4c5fa9c 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,8 @@ SOURCE_FILES := $(shell find src/kernel -name *.c -or -name *.asm -or -name *.s) OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) -USER_PROGRAMS := $(shell tree -d -L 1 -i --noreport src/userland/ | tail -n+2) -USER_PROGRAM_NAMES := $(USER_PROGRAMS:%=user/%) -USER_PROGRAM_FILES := $(USER_PROGRAMS:%=initrd/%) -run: build initrd hlib $(USER_PROGRAM_NAMES) $(IMAGE_FILE) +run: build initrd hlib userPrograms $(IMAGE_FILE) @echo "starting qemu" @$(EMU) $(EMUFLAGS) @@ -67,14 +64,12 @@ @mkdir -p $(dir $@) @$(CC) $(CCFLAGS) -r $< -o $@ -user/%: src/userland/% - @echo "compiling userspace program $<" - @make -C $< +userPrograms: + @make --silent -C src/userland hlib: - @echo "compiling userspace honey-os library" - @make -C src/hlib + @make --silent -C src/hlib clean: @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) initrd src/userland/*/build + @rm -r $(BUILD_FOLDER) initrd src/userland/build diff --git a/src/userland/Makefile b/src/userland/Makefile new file mode 100644 index 0000000..24e4916 --- /dev/null +++ b/src/userland/Makefile @@ -0,0 +1,41 @@ +CC = i686-elf-gcc +CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero +LD = i686-elf-ld +LD_FLAGS = -z max-page-size=0x1000 -T link.ld --no-warn-rwx-segment +AS = nasm +ASFlAGS = -felf32 + +SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) +OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) + +PROGRAM_NAMES := $(shell ls -d */ | sed "s/\/$$//" | sed "s|build||") +PROGRAMS := $(PROGRAM_NAMES:%=../../initrd/%) + +all: $(PROGRAMS) + +.SUFFIXES: + +define MAKE_PROGRAM + +../../initrd/$(1): $(2) + @echo "linking $(1) from $$^" + @$(LD) $(LD_FLAGS) -o $$@ $$^ + +build/$(1)/%.c.o: $(1)/%.c + @echo "compiling '$$<' to '$$@' for $(1)" + @mkdir -p $$(dir $$@) + @$(CC) $(CCFLAGS) $$< -o $$@ -I $(1)/include + +endef + +$(foreach NAME, $(PROGRAM_NAMES), $(eval $(call MAKE_PROGRAM,$(NAME),$(shell find $(NAME) -name "*.c" | sed "s|$$|.o|" | sed "s|^|build/|")))) + + +# $(shell find $(subst user/,,$@) -name "*.c" | sed "s?/\([^/]*\)?/build/\1?") +#user/%: $$(shell echo "test") +# NAME=$$(echo $@ | sed "s?user/??"); \ +# SOURCES=$$(find $$NAME -name "*.c"); \ +# OBJS=$$(echo $$SOURCES | sed "s|$$|.o|" | sed "s|^|build/|"); \ +# make $$OBJS;\ +# echo "linking $@ $<";\ +# $(LD) $(LD_FLAGS) -I include$$NAME -o ../../initrd/$$NAME diff --git a/src/userland/crashTest/Makefile b/src/userland/crashTest/Makefile deleted file mode 100644 index 9be876f..0000000 --- a/src/userland/crashTest/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/crashTest: $(OBJS) ../../../build/hlib.o - @echo "linking user programm crash test" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/hid/Makefile b/src/userland/hid/Makefile deleted file mode 100644 index 81bcd9d..0000000 --- a/src/userland/hid/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name "*.c" -or -name "*.asm" -or -name "*.s") -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = hid - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/ioManager/Makefile b/src/userland/ioManager/Makefile deleted file mode 100644 index 0b0ac8e..0000000 --- a/src/userland/ioManager/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/ioManager: $(OBJS) ../../../build/hlib.o - @echo "linking user program io manager" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/keyboard/Makefile b/src/userland/keyboard/Makefile deleted file mode 100644 index 99ace25..0000000 --- a/src/userland/keyboard/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/keyboard: $(OBJS) ../../../build/hlib.o - @echo "linking user program PS/2 keyboard" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/link.ld b/src/userland/link.ld index cd5fb81..f9cdecc 100644 --- a/src/userland/link.ld +++ b/src/userland/link.ld @@ -1,7 +1,7 @@ OUTPUT_ARCH(i386) ENTRY(main) -INPUT( ../../../build/hlib.o) +INPUT( ../../build/hlib.o) SECTIONS { . = 0x80000000; diff --git a/src/userland/loader/Makefile b/src/userland/loader/Makefile deleted file mode 100644 index 2c52ec5..0000000 --- a/src/userland/loader/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/loader: $(OBJS) ../../../build/hlib.o - @echo "linking user program loader" - @$(LD) $(LD_FLAGS) -o ../../../initrd/loader $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/log/Makefile b/src/userland/log/Makefile deleted file mode 100644 index fb17fcb..0000000 --- a/src/userland/log/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/log: $(OBJS) ../../../build/hlib.o - @echo "linking user program log" - @$(LD) $(LD_FLAGS) -o ../../../initrd/log $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/Makefile b/Makefile index 6a72399..4c5fa9c 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,8 @@ SOURCE_FILES := $(shell find src/kernel -name *.c -or -name *.asm -or -name *.s) OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) -USER_PROGRAMS := $(shell tree -d -L 1 -i --noreport src/userland/ | tail -n+2) -USER_PROGRAM_NAMES := $(USER_PROGRAMS:%=user/%) -USER_PROGRAM_FILES := $(USER_PROGRAMS:%=initrd/%) -run: build initrd hlib $(USER_PROGRAM_NAMES) $(IMAGE_FILE) +run: build initrd hlib userPrograms $(IMAGE_FILE) @echo "starting qemu" @$(EMU) $(EMUFLAGS) @@ -67,14 +64,12 @@ @mkdir -p $(dir $@) @$(CC) $(CCFLAGS) -r $< -o $@ -user/%: src/userland/% - @echo "compiling userspace program $<" - @make -C $< +userPrograms: + @make --silent -C src/userland hlib: - @echo "compiling userspace honey-os library" - @make -C src/hlib + @make --silent -C src/hlib clean: @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) initrd src/userland/*/build + @rm -r $(BUILD_FOLDER) initrd src/userland/build diff --git a/src/userland/Makefile b/src/userland/Makefile new file mode 100644 index 0000000..24e4916 --- /dev/null +++ b/src/userland/Makefile @@ -0,0 +1,41 @@ +CC = i686-elf-gcc +CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero +LD = i686-elf-ld +LD_FLAGS = -z max-page-size=0x1000 -T link.ld --no-warn-rwx-segment +AS = nasm +ASFlAGS = -felf32 + +SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) +OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) + +PROGRAM_NAMES := $(shell ls -d */ | sed "s/\/$$//" | sed "s|build||") +PROGRAMS := $(PROGRAM_NAMES:%=../../initrd/%) + +all: $(PROGRAMS) + +.SUFFIXES: + +define MAKE_PROGRAM + +../../initrd/$(1): $(2) + @echo "linking $(1) from $$^" + @$(LD) $(LD_FLAGS) -o $$@ $$^ + +build/$(1)/%.c.o: $(1)/%.c + @echo "compiling '$$<' to '$$@' for $(1)" + @mkdir -p $$(dir $$@) + @$(CC) $(CCFLAGS) $$< -o $$@ -I $(1)/include + +endef + +$(foreach NAME, $(PROGRAM_NAMES), $(eval $(call MAKE_PROGRAM,$(NAME),$(shell find $(NAME) -name "*.c" | sed "s|$$|.o|" | sed "s|^|build/|")))) + + +# $(shell find $(subst user/,,$@) -name "*.c" | sed "s?/\([^/]*\)?/build/\1?") +#user/%: $$(shell echo "test") +# NAME=$$(echo $@ | sed "s?user/??"); \ +# SOURCES=$$(find $$NAME -name "*.c"); \ +# OBJS=$$(echo $$SOURCES | sed "s|$$|.o|" | sed "s|^|build/|"); \ +# make $$OBJS;\ +# echo "linking $@ $<";\ +# $(LD) $(LD_FLAGS) -I include$$NAME -o ../../initrd/$$NAME diff --git a/src/userland/crashTest/Makefile b/src/userland/crashTest/Makefile deleted file mode 100644 index 9be876f..0000000 --- a/src/userland/crashTest/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/crashTest: $(OBJS) ../../../build/hlib.o - @echo "linking user programm crash test" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/hid/Makefile b/src/userland/hid/Makefile deleted file mode 100644 index 81bcd9d..0000000 --- a/src/userland/hid/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name "*.c" -or -name "*.asm" -or -name "*.s") -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = hid - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/ioManager/Makefile b/src/userland/ioManager/Makefile deleted file mode 100644 index 0b0ac8e..0000000 --- a/src/userland/ioManager/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/ioManager: $(OBJS) ../../../build/hlib.o - @echo "linking user program io manager" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/keyboard/Makefile b/src/userland/keyboard/Makefile deleted file mode 100644 index 99ace25..0000000 --- a/src/userland/keyboard/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/keyboard: $(OBJS) ../../../build/hlib.o - @echo "linking user program PS/2 keyboard" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/link.ld b/src/userland/link.ld index cd5fb81..f9cdecc 100644 --- a/src/userland/link.ld +++ b/src/userland/link.ld @@ -1,7 +1,7 @@ OUTPUT_ARCH(i386) ENTRY(main) -INPUT( ../../../build/hlib.o) +INPUT( ../../build/hlib.o) SECTIONS { . = 0x80000000; diff --git a/src/userland/loader/Makefile b/src/userland/loader/Makefile deleted file mode 100644 index 2c52ec5..0000000 --- a/src/userland/loader/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/loader: $(OBJS) ../../../build/hlib.o - @echo "linking user program loader" - @$(LD) $(LD_FLAGS) -o ../../../initrd/loader $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/log/Makefile b/src/userland/log/Makefile deleted file mode 100644 index fb17fcb..0000000 --- a/src/userland/log/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/log: $(OBJS) ../../../build/hlib.o - @echo "linking user program log" - @$(LD) $(LD_FLAGS) -o ../../../initrd/log $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/lspci/Makefile b/src/userland/lspci/Makefile deleted file mode 100644 index 4dff6a0..0000000 --- a/src/userland/lspci/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = lspci - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/Makefile b/Makefile index 6a72399..4c5fa9c 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,8 @@ SOURCE_FILES := $(shell find src/kernel -name *.c -or -name *.asm -or -name *.s) OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) -USER_PROGRAMS := $(shell tree -d -L 1 -i --noreport src/userland/ | tail -n+2) -USER_PROGRAM_NAMES := $(USER_PROGRAMS:%=user/%) -USER_PROGRAM_FILES := $(USER_PROGRAMS:%=initrd/%) -run: build initrd hlib $(USER_PROGRAM_NAMES) $(IMAGE_FILE) +run: build initrd hlib userPrograms $(IMAGE_FILE) @echo "starting qemu" @$(EMU) $(EMUFLAGS) @@ -67,14 +64,12 @@ @mkdir -p $(dir $@) @$(CC) $(CCFLAGS) -r $< -o $@ -user/%: src/userland/% - @echo "compiling userspace program $<" - @make -C $< +userPrograms: + @make --silent -C src/userland hlib: - @echo "compiling userspace honey-os library" - @make -C src/hlib + @make --silent -C src/hlib clean: @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) initrd src/userland/*/build + @rm -r $(BUILD_FOLDER) initrd src/userland/build diff --git a/src/userland/Makefile b/src/userland/Makefile new file mode 100644 index 0000000..24e4916 --- /dev/null +++ b/src/userland/Makefile @@ -0,0 +1,41 @@ +CC = i686-elf-gcc +CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero +LD = i686-elf-ld +LD_FLAGS = -z max-page-size=0x1000 -T link.ld --no-warn-rwx-segment +AS = nasm +ASFlAGS = -felf32 + +SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) +OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) + +PROGRAM_NAMES := $(shell ls -d */ | sed "s/\/$$//" | sed "s|build||") +PROGRAMS := $(PROGRAM_NAMES:%=../../initrd/%) + +all: $(PROGRAMS) + +.SUFFIXES: + +define MAKE_PROGRAM + +../../initrd/$(1): $(2) + @echo "linking $(1) from $$^" + @$(LD) $(LD_FLAGS) -o $$@ $$^ + +build/$(1)/%.c.o: $(1)/%.c + @echo "compiling '$$<' to '$$@' for $(1)" + @mkdir -p $$(dir $$@) + @$(CC) $(CCFLAGS) $$< -o $$@ -I $(1)/include + +endef + +$(foreach NAME, $(PROGRAM_NAMES), $(eval $(call MAKE_PROGRAM,$(NAME),$(shell find $(NAME) -name "*.c" | sed "s|$$|.o|" | sed "s|^|build/|")))) + + +# $(shell find $(subst user/,,$@) -name "*.c" | sed "s?/\([^/]*\)?/build/\1?") +#user/%: $$(shell echo "test") +# NAME=$$(echo $@ | sed "s?user/??"); \ +# SOURCES=$$(find $$NAME -name "*.c"); \ +# OBJS=$$(echo $$SOURCES | sed "s|$$|.o|" | sed "s|^|build/|"); \ +# make $$OBJS;\ +# echo "linking $@ $<";\ +# $(LD) $(LD_FLAGS) -I include$$NAME -o ../../initrd/$$NAME diff --git a/src/userland/crashTest/Makefile b/src/userland/crashTest/Makefile deleted file mode 100644 index 9be876f..0000000 --- a/src/userland/crashTest/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/crashTest: $(OBJS) ../../../build/hlib.o - @echo "linking user programm crash test" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/hid/Makefile b/src/userland/hid/Makefile deleted file mode 100644 index 81bcd9d..0000000 --- a/src/userland/hid/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name "*.c" -or -name "*.asm" -or -name "*.s") -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = hid - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/ioManager/Makefile b/src/userland/ioManager/Makefile deleted file mode 100644 index 0b0ac8e..0000000 --- a/src/userland/ioManager/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/ioManager: $(OBJS) ../../../build/hlib.o - @echo "linking user program io manager" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/keyboard/Makefile b/src/userland/keyboard/Makefile deleted file mode 100644 index 99ace25..0000000 --- a/src/userland/keyboard/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/keyboard: $(OBJS) ../../../build/hlib.o - @echo "linking user program PS/2 keyboard" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/link.ld b/src/userland/link.ld index cd5fb81..f9cdecc 100644 --- a/src/userland/link.ld +++ b/src/userland/link.ld @@ -1,7 +1,7 @@ OUTPUT_ARCH(i386) ENTRY(main) -INPUT( ../../../build/hlib.o) +INPUT( ../../build/hlib.o) SECTIONS { . = 0x80000000; diff --git a/src/userland/loader/Makefile b/src/userland/loader/Makefile deleted file mode 100644 index 2c52ec5..0000000 --- a/src/userland/loader/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/loader: $(OBJS) ../../../build/hlib.o - @echo "linking user program loader" - @$(LD) $(LD_FLAGS) -o ../../../initrd/loader $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/log/Makefile b/src/userland/log/Makefile deleted file mode 100644 index fb17fcb..0000000 --- a/src/userland/log/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/log: $(OBJS) ../../../build/hlib.o - @echo "linking user program log" - @$(LD) $(LD_FLAGS) -o ../../../initrd/log $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/lspci/Makefile b/src/userland/lspci/Makefile deleted file mode 100644 index 4dff6a0..0000000 --- a/src/userland/lspci/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = lspci - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/mouse/Makefile b/src/userland/mouse/Makefile deleted file mode 100644 index 4dd1acb..0000000 --- a/src/userland/mouse/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = mouse - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/Makefile b/Makefile index 6a72399..4c5fa9c 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,8 @@ SOURCE_FILES := $(shell find src/kernel -name *.c -or -name *.asm -or -name *.s) OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) -USER_PROGRAMS := $(shell tree -d -L 1 -i --noreport src/userland/ | tail -n+2) -USER_PROGRAM_NAMES := $(USER_PROGRAMS:%=user/%) -USER_PROGRAM_FILES := $(USER_PROGRAMS:%=initrd/%) -run: build initrd hlib $(USER_PROGRAM_NAMES) $(IMAGE_FILE) +run: build initrd hlib userPrograms $(IMAGE_FILE) @echo "starting qemu" @$(EMU) $(EMUFLAGS) @@ -67,14 +64,12 @@ @mkdir -p $(dir $@) @$(CC) $(CCFLAGS) -r $< -o $@ -user/%: src/userland/% - @echo "compiling userspace program $<" - @make -C $< +userPrograms: + @make --silent -C src/userland hlib: - @echo "compiling userspace honey-os library" - @make -C src/hlib + @make --silent -C src/hlib clean: @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) initrd src/userland/*/build + @rm -r $(BUILD_FOLDER) initrd src/userland/build diff --git a/src/userland/Makefile b/src/userland/Makefile new file mode 100644 index 0000000..24e4916 --- /dev/null +++ b/src/userland/Makefile @@ -0,0 +1,41 @@ +CC = i686-elf-gcc +CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero +LD = i686-elf-ld +LD_FLAGS = -z max-page-size=0x1000 -T link.ld --no-warn-rwx-segment +AS = nasm +ASFlAGS = -felf32 + +SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) +OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) + +PROGRAM_NAMES := $(shell ls -d */ | sed "s/\/$$//" | sed "s|build||") +PROGRAMS := $(PROGRAM_NAMES:%=../../initrd/%) + +all: $(PROGRAMS) + +.SUFFIXES: + +define MAKE_PROGRAM + +../../initrd/$(1): $(2) + @echo "linking $(1) from $$^" + @$(LD) $(LD_FLAGS) -o $$@ $$^ + +build/$(1)/%.c.o: $(1)/%.c + @echo "compiling '$$<' to '$$@' for $(1)" + @mkdir -p $$(dir $$@) + @$(CC) $(CCFLAGS) $$< -o $$@ -I $(1)/include + +endef + +$(foreach NAME, $(PROGRAM_NAMES), $(eval $(call MAKE_PROGRAM,$(NAME),$(shell find $(NAME) -name "*.c" | sed "s|$$|.o|" | sed "s|^|build/|")))) + + +# $(shell find $(subst user/,,$@) -name "*.c" | sed "s?/\([^/]*\)?/build/\1?") +#user/%: $$(shell echo "test") +# NAME=$$(echo $@ | sed "s?user/??"); \ +# SOURCES=$$(find $$NAME -name "*.c"); \ +# OBJS=$$(echo $$SOURCES | sed "s|$$|.o|" | sed "s|^|build/|"); \ +# make $$OBJS;\ +# echo "linking $@ $<";\ +# $(LD) $(LD_FLAGS) -I include$$NAME -o ../../initrd/$$NAME diff --git a/src/userland/crashTest/Makefile b/src/userland/crashTest/Makefile deleted file mode 100644 index 9be876f..0000000 --- a/src/userland/crashTest/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/crashTest: $(OBJS) ../../../build/hlib.o - @echo "linking user programm crash test" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/hid/Makefile b/src/userland/hid/Makefile deleted file mode 100644 index 81bcd9d..0000000 --- a/src/userland/hid/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name "*.c" -or -name "*.asm" -or -name "*.s") -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = hid - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/ioManager/Makefile b/src/userland/ioManager/Makefile deleted file mode 100644 index 0b0ac8e..0000000 --- a/src/userland/ioManager/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/ioManager: $(OBJS) ../../../build/hlib.o - @echo "linking user program io manager" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/keyboard/Makefile b/src/userland/keyboard/Makefile deleted file mode 100644 index 99ace25..0000000 --- a/src/userland/keyboard/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/keyboard: $(OBJS) ../../../build/hlib.o - @echo "linking user program PS/2 keyboard" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/link.ld b/src/userland/link.ld index cd5fb81..f9cdecc 100644 --- a/src/userland/link.ld +++ b/src/userland/link.ld @@ -1,7 +1,7 @@ OUTPUT_ARCH(i386) ENTRY(main) -INPUT( ../../../build/hlib.o) +INPUT( ../../build/hlib.o) SECTIONS { . = 0x80000000; diff --git a/src/userland/loader/Makefile b/src/userland/loader/Makefile deleted file mode 100644 index 2c52ec5..0000000 --- a/src/userland/loader/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/loader: $(OBJS) ../../../build/hlib.o - @echo "linking user program loader" - @$(LD) $(LD_FLAGS) -o ../../../initrd/loader $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/log/Makefile b/src/userland/log/Makefile deleted file mode 100644 index fb17fcb..0000000 --- a/src/userland/log/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/log: $(OBJS) ../../../build/hlib.o - @echo "linking user program log" - @$(LD) $(LD_FLAGS) -o ../../../initrd/log $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/lspci/Makefile b/src/userland/lspci/Makefile deleted file mode 100644 index 4dff6a0..0000000 --- a/src/userland/lspci/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = lspci - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/mouse/Makefile b/src/userland/mouse/Makefile deleted file mode 100644 index 4dd1acb..0000000 --- a/src/userland/mouse/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = mouse - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/parallel/Makefile b/src/userland/parallel/Makefile deleted file mode 100644 index 308795d..0000000 --- a/src/userland/parallel/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = parallel - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/Makefile b/Makefile index 6a72399..4c5fa9c 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,8 @@ SOURCE_FILES := $(shell find src/kernel -name *.c -or -name *.asm -or -name *.s) OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) -USER_PROGRAMS := $(shell tree -d -L 1 -i --noreport src/userland/ | tail -n+2) -USER_PROGRAM_NAMES := $(USER_PROGRAMS:%=user/%) -USER_PROGRAM_FILES := $(USER_PROGRAMS:%=initrd/%) -run: build initrd hlib $(USER_PROGRAM_NAMES) $(IMAGE_FILE) +run: build initrd hlib userPrograms $(IMAGE_FILE) @echo "starting qemu" @$(EMU) $(EMUFLAGS) @@ -67,14 +64,12 @@ @mkdir -p $(dir $@) @$(CC) $(CCFLAGS) -r $< -o $@ -user/%: src/userland/% - @echo "compiling userspace program $<" - @make -C $< +userPrograms: + @make --silent -C src/userland hlib: - @echo "compiling userspace honey-os library" - @make -C src/hlib + @make --silent -C src/hlib clean: @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) initrd src/userland/*/build + @rm -r $(BUILD_FOLDER) initrd src/userland/build diff --git a/src/userland/Makefile b/src/userland/Makefile new file mode 100644 index 0000000..24e4916 --- /dev/null +++ b/src/userland/Makefile @@ -0,0 +1,41 @@ +CC = i686-elf-gcc +CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero +LD = i686-elf-ld +LD_FLAGS = -z max-page-size=0x1000 -T link.ld --no-warn-rwx-segment +AS = nasm +ASFlAGS = -felf32 + +SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) +OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) + +PROGRAM_NAMES := $(shell ls -d */ | sed "s/\/$$//" | sed "s|build||") +PROGRAMS := $(PROGRAM_NAMES:%=../../initrd/%) + +all: $(PROGRAMS) + +.SUFFIXES: + +define MAKE_PROGRAM + +../../initrd/$(1): $(2) + @echo "linking $(1) from $$^" + @$(LD) $(LD_FLAGS) -o $$@ $$^ + +build/$(1)/%.c.o: $(1)/%.c + @echo "compiling '$$<' to '$$@' for $(1)" + @mkdir -p $$(dir $$@) + @$(CC) $(CCFLAGS) $$< -o $$@ -I $(1)/include + +endef + +$(foreach NAME, $(PROGRAM_NAMES), $(eval $(call MAKE_PROGRAM,$(NAME),$(shell find $(NAME) -name "*.c" | sed "s|$$|.o|" | sed "s|^|build/|")))) + + +# $(shell find $(subst user/,,$@) -name "*.c" | sed "s?/\([^/]*\)?/build/\1?") +#user/%: $$(shell echo "test") +# NAME=$$(echo $@ | sed "s?user/??"); \ +# SOURCES=$$(find $$NAME -name "*.c"); \ +# OBJS=$$(echo $$SOURCES | sed "s|$$|.o|" | sed "s|^|build/|"); \ +# make $$OBJS;\ +# echo "linking $@ $<";\ +# $(LD) $(LD_FLAGS) -I include$$NAME -o ../../initrd/$$NAME diff --git a/src/userland/crashTest/Makefile b/src/userland/crashTest/Makefile deleted file mode 100644 index 9be876f..0000000 --- a/src/userland/crashTest/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/crashTest: $(OBJS) ../../../build/hlib.o - @echo "linking user programm crash test" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/hid/Makefile b/src/userland/hid/Makefile deleted file mode 100644 index 81bcd9d..0000000 --- a/src/userland/hid/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name "*.c" -or -name "*.asm" -or -name "*.s") -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = hid - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/ioManager/Makefile b/src/userland/ioManager/Makefile deleted file mode 100644 index 0b0ac8e..0000000 --- a/src/userland/ioManager/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/ioManager: $(OBJS) ../../../build/hlib.o - @echo "linking user program io manager" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/keyboard/Makefile b/src/userland/keyboard/Makefile deleted file mode 100644 index 99ace25..0000000 --- a/src/userland/keyboard/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/keyboard: $(OBJS) ../../../build/hlib.o - @echo "linking user program PS/2 keyboard" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/link.ld b/src/userland/link.ld index cd5fb81..f9cdecc 100644 --- a/src/userland/link.ld +++ b/src/userland/link.ld @@ -1,7 +1,7 @@ OUTPUT_ARCH(i386) ENTRY(main) -INPUT( ../../../build/hlib.o) +INPUT( ../../build/hlib.o) SECTIONS { . = 0x80000000; diff --git a/src/userland/loader/Makefile b/src/userland/loader/Makefile deleted file mode 100644 index 2c52ec5..0000000 --- a/src/userland/loader/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/loader: $(OBJS) ../../../build/hlib.o - @echo "linking user program loader" - @$(LD) $(LD_FLAGS) -o ../../../initrd/loader $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/log/Makefile b/src/userland/log/Makefile deleted file mode 100644 index fb17fcb..0000000 --- a/src/userland/log/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/log: $(OBJS) ../../../build/hlib.o - @echo "linking user program log" - @$(LD) $(LD_FLAGS) -o ../../../initrd/log $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/lspci/Makefile b/src/userland/lspci/Makefile deleted file mode 100644 index 4dff6a0..0000000 --- a/src/userland/lspci/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = lspci - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/mouse/Makefile b/src/userland/mouse/Makefile deleted file mode 100644 index 4dd1acb..0000000 --- a/src/userland/mouse/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = mouse - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/parallel/Makefile b/src/userland/parallel/Makefile deleted file mode 100644 index 308795d..0000000 --- a/src/userland/parallel/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = parallel - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/pic/Makefile b/src/userland/pic/Makefile deleted file mode 100644 index 573d46d..0000000 --- a/src/userland/pic/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/pic: $(OBJS) ../../../build/hlib.o - @echo "linking user program 8259 PIC" - @$(LD) $(LD_FLAGS) -o ../../../initrd/pic $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/Makefile b/Makefile index 6a72399..4c5fa9c 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,8 @@ SOURCE_FILES := $(shell find src/kernel -name *.c -or -name *.asm -or -name *.s) OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) -USER_PROGRAMS := $(shell tree -d -L 1 -i --noreport src/userland/ | tail -n+2) -USER_PROGRAM_NAMES := $(USER_PROGRAMS:%=user/%) -USER_PROGRAM_FILES := $(USER_PROGRAMS:%=initrd/%) -run: build initrd hlib $(USER_PROGRAM_NAMES) $(IMAGE_FILE) +run: build initrd hlib userPrograms $(IMAGE_FILE) @echo "starting qemu" @$(EMU) $(EMUFLAGS) @@ -67,14 +64,12 @@ @mkdir -p $(dir $@) @$(CC) $(CCFLAGS) -r $< -o $@ -user/%: src/userland/% - @echo "compiling userspace program $<" - @make -C $< +userPrograms: + @make --silent -C src/userland hlib: - @echo "compiling userspace honey-os library" - @make -C src/hlib + @make --silent -C src/hlib clean: @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) initrd src/userland/*/build + @rm -r $(BUILD_FOLDER) initrd src/userland/build diff --git a/src/userland/Makefile b/src/userland/Makefile new file mode 100644 index 0000000..24e4916 --- /dev/null +++ b/src/userland/Makefile @@ -0,0 +1,41 @@ +CC = i686-elf-gcc +CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero +LD = i686-elf-ld +LD_FLAGS = -z max-page-size=0x1000 -T link.ld --no-warn-rwx-segment +AS = nasm +ASFlAGS = -felf32 + +SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) +OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) + +PROGRAM_NAMES := $(shell ls -d */ | sed "s/\/$$//" | sed "s|build||") +PROGRAMS := $(PROGRAM_NAMES:%=../../initrd/%) + +all: $(PROGRAMS) + +.SUFFIXES: + +define MAKE_PROGRAM + +../../initrd/$(1): $(2) + @echo "linking $(1) from $$^" + @$(LD) $(LD_FLAGS) -o $$@ $$^ + +build/$(1)/%.c.o: $(1)/%.c + @echo "compiling '$$<' to '$$@' for $(1)" + @mkdir -p $$(dir $$@) + @$(CC) $(CCFLAGS) $$< -o $$@ -I $(1)/include + +endef + +$(foreach NAME, $(PROGRAM_NAMES), $(eval $(call MAKE_PROGRAM,$(NAME),$(shell find $(NAME) -name "*.c" | sed "s|$$|.o|" | sed "s|^|build/|")))) + + +# $(shell find $(subst user/,,$@) -name "*.c" | sed "s?/\([^/]*\)?/build/\1?") +#user/%: $$(shell echo "test") +# NAME=$$(echo $@ | sed "s?user/??"); \ +# SOURCES=$$(find $$NAME -name "*.c"); \ +# OBJS=$$(echo $$SOURCES | sed "s|$$|.o|" | sed "s|^|build/|"); \ +# make $$OBJS;\ +# echo "linking $@ $<";\ +# $(LD) $(LD_FLAGS) -I include$$NAME -o ../../initrd/$$NAME diff --git a/src/userland/crashTest/Makefile b/src/userland/crashTest/Makefile deleted file mode 100644 index 9be876f..0000000 --- a/src/userland/crashTest/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/crashTest: $(OBJS) ../../../build/hlib.o - @echo "linking user programm crash test" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/hid/Makefile b/src/userland/hid/Makefile deleted file mode 100644 index 81bcd9d..0000000 --- a/src/userland/hid/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name "*.c" -or -name "*.asm" -or -name "*.s") -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = hid - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/ioManager/Makefile b/src/userland/ioManager/Makefile deleted file mode 100644 index 0b0ac8e..0000000 --- a/src/userland/ioManager/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/ioManager: $(OBJS) ../../../build/hlib.o - @echo "linking user program io manager" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/keyboard/Makefile b/src/userland/keyboard/Makefile deleted file mode 100644 index 99ace25..0000000 --- a/src/userland/keyboard/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/keyboard: $(OBJS) ../../../build/hlib.o - @echo "linking user program PS/2 keyboard" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/link.ld b/src/userland/link.ld index cd5fb81..f9cdecc 100644 --- a/src/userland/link.ld +++ b/src/userland/link.ld @@ -1,7 +1,7 @@ OUTPUT_ARCH(i386) ENTRY(main) -INPUT( ../../../build/hlib.o) +INPUT( ../../build/hlib.o) SECTIONS { . = 0x80000000; diff --git a/src/userland/loader/Makefile b/src/userland/loader/Makefile deleted file mode 100644 index 2c52ec5..0000000 --- a/src/userland/loader/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/loader: $(OBJS) ../../../build/hlib.o - @echo "linking user program loader" - @$(LD) $(LD_FLAGS) -o ../../../initrd/loader $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/log/Makefile b/src/userland/log/Makefile deleted file mode 100644 index fb17fcb..0000000 --- a/src/userland/log/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/log: $(OBJS) ../../../build/hlib.o - @echo "linking user program log" - @$(LD) $(LD_FLAGS) -o ../../../initrd/log $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/lspci/Makefile b/src/userland/lspci/Makefile deleted file mode 100644 index 4dff6a0..0000000 --- a/src/userland/lspci/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = lspci - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/mouse/Makefile b/src/userland/mouse/Makefile deleted file mode 100644 index 4dd1acb..0000000 --- a/src/userland/mouse/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = mouse - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/parallel/Makefile b/src/userland/parallel/Makefile deleted file mode 100644 index 308795d..0000000 --- a/src/userland/parallel/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = parallel - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/pic/Makefile b/src/userland/pic/Makefile deleted file mode 100644 index 573d46d..0000000 --- a/src/userland/pic/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/pic: $(OBJS) ../../../build/hlib.o - @echo "linking user program 8259 PIC" - @$(LD) $(LD_FLAGS) -o ../../../initrd/pic $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/pit/Makefile b/src/userland/pit/Makefile deleted file mode 100644 index ad7d5fd..0000000 --- a/src/userland/pit/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = pit - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/Makefile b/Makefile index 6a72399..4c5fa9c 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,8 @@ SOURCE_FILES := $(shell find src/kernel -name *.c -or -name *.asm -or -name *.s) OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) -USER_PROGRAMS := $(shell tree -d -L 1 -i --noreport src/userland/ | tail -n+2) -USER_PROGRAM_NAMES := $(USER_PROGRAMS:%=user/%) -USER_PROGRAM_FILES := $(USER_PROGRAMS:%=initrd/%) -run: build initrd hlib $(USER_PROGRAM_NAMES) $(IMAGE_FILE) +run: build initrd hlib userPrograms $(IMAGE_FILE) @echo "starting qemu" @$(EMU) $(EMUFLAGS) @@ -67,14 +64,12 @@ @mkdir -p $(dir $@) @$(CC) $(CCFLAGS) -r $< -o $@ -user/%: src/userland/% - @echo "compiling userspace program $<" - @make -C $< +userPrograms: + @make --silent -C src/userland hlib: - @echo "compiling userspace honey-os library" - @make -C src/hlib + @make --silent -C src/hlib clean: @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) initrd src/userland/*/build + @rm -r $(BUILD_FOLDER) initrd src/userland/build diff --git a/src/userland/Makefile b/src/userland/Makefile new file mode 100644 index 0000000..24e4916 --- /dev/null +++ b/src/userland/Makefile @@ -0,0 +1,41 @@ +CC = i686-elf-gcc +CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero +LD = i686-elf-ld +LD_FLAGS = -z max-page-size=0x1000 -T link.ld --no-warn-rwx-segment +AS = nasm +ASFlAGS = -felf32 + +SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) +OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) + +PROGRAM_NAMES := $(shell ls -d */ | sed "s/\/$$//" | sed "s|build||") +PROGRAMS := $(PROGRAM_NAMES:%=../../initrd/%) + +all: $(PROGRAMS) + +.SUFFIXES: + +define MAKE_PROGRAM + +../../initrd/$(1): $(2) + @echo "linking $(1) from $$^" + @$(LD) $(LD_FLAGS) -o $$@ $$^ + +build/$(1)/%.c.o: $(1)/%.c + @echo "compiling '$$<' to '$$@' for $(1)" + @mkdir -p $$(dir $$@) + @$(CC) $(CCFLAGS) $$< -o $$@ -I $(1)/include + +endef + +$(foreach NAME, $(PROGRAM_NAMES), $(eval $(call MAKE_PROGRAM,$(NAME),$(shell find $(NAME) -name "*.c" | sed "s|$$|.o|" | sed "s|^|build/|")))) + + +# $(shell find $(subst user/,,$@) -name "*.c" | sed "s?/\([^/]*\)?/build/\1?") +#user/%: $$(shell echo "test") +# NAME=$$(echo $@ | sed "s?user/??"); \ +# SOURCES=$$(find $$NAME -name "*.c"); \ +# OBJS=$$(echo $$SOURCES | sed "s|$$|.o|" | sed "s|^|build/|"); \ +# make $$OBJS;\ +# echo "linking $@ $<";\ +# $(LD) $(LD_FLAGS) -I include$$NAME -o ../../initrd/$$NAME diff --git a/src/userland/crashTest/Makefile b/src/userland/crashTest/Makefile deleted file mode 100644 index 9be876f..0000000 --- a/src/userland/crashTest/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/crashTest: $(OBJS) ../../../build/hlib.o - @echo "linking user programm crash test" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/hid/Makefile b/src/userland/hid/Makefile deleted file mode 100644 index 81bcd9d..0000000 --- a/src/userland/hid/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name "*.c" -or -name "*.asm" -or -name "*.s") -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = hid - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/ioManager/Makefile b/src/userland/ioManager/Makefile deleted file mode 100644 index 0b0ac8e..0000000 --- a/src/userland/ioManager/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/ioManager: $(OBJS) ../../../build/hlib.o - @echo "linking user program io manager" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/keyboard/Makefile b/src/userland/keyboard/Makefile deleted file mode 100644 index 99ace25..0000000 --- a/src/userland/keyboard/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/keyboard: $(OBJS) ../../../build/hlib.o - @echo "linking user program PS/2 keyboard" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/link.ld b/src/userland/link.ld index cd5fb81..f9cdecc 100644 --- a/src/userland/link.ld +++ b/src/userland/link.ld @@ -1,7 +1,7 @@ OUTPUT_ARCH(i386) ENTRY(main) -INPUT( ../../../build/hlib.o) +INPUT( ../../build/hlib.o) SECTIONS { . = 0x80000000; diff --git a/src/userland/loader/Makefile b/src/userland/loader/Makefile deleted file mode 100644 index 2c52ec5..0000000 --- a/src/userland/loader/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/loader: $(OBJS) ../../../build/hlib.o - @echo "linking user program loader" - @$(LD) $(LD_FLAGS) -o ../../../initrd/loader $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/log/Makefile b/src/userland/log/Makefile deleted file mode 100644 index fb17fcb..0000000 --- a/src/userland/log/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/log: $(OBJS) ../../../build/hlib.o - @echo "linking user program log" - @$(LD) $(LD_FLAGS) -o ../../../initrd/log $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/lspci/Makefile b/src/userland/lspci/Makefile deleted file mode 100644 index 4dff6a0..0000000 --- a/src/userland/lspci/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = lspci - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/mouse/Makefile b/src/userland/mouse/Makefile deleted file mode 100644 index 4dd1acb..0000000 --- a/src/userland/mouse/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = mouse - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/parallel/Makefile b/src/userland/parallel/Makefile deleted file mode 100644 index 308795d..0000000 --- a/src/userland/parallel/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = parallel - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/pic/Makefile b/src/userland/pic/Makefile deleted file mode 100644 index 573d46d..0000000 --- a/src/userland/pic/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/pic: $(OBJS) ../../../build/hlib.o - @echo "linking user program 8259 PIC" - @$(LD) $(LD_FLAGS) -o ../../../initrd/pic $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/pit/Makefile b/src/userland/pit/Makefile deleted file mode 100644 index ad7d5fd..0000000 --- a/src/userland/pit/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = pit - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/ps2/Makefile b/src/userland/ps2/Makefile deleted file mode 100644 index a5855c4..0000000 --- a/src/userland/ps2/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = ps2 - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/Makefile b/Makefile index 6a72399..4c5fa9c 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,8 @@ SOURCE_FILES := $(shell find src/kernel -name *.c -or -name *.asm -or -name *.s) OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) -USER_PROGRAMS := $(shell tree -d -L 1 -i --noreport src/userland/ | tail -n+2) -USER_PROGRAM_NAMES := $(USER_PROGRAMS:%=user/%) -USER_PROGRAM_FILES := $(USER_PROGRAMS:%=initrd/%) -run: build initrd hlib $(USER_PROGRAM_NAMES) $(IMAGE_FILE) +run: build initrd hlib userPrograms $(IMAGE_FILE) @echo "starting qemu" @$(EMU) $(EMUFLAGS) @@ -67,14 +64,12 @@ @mkdir -p $(dir $@) @$(CC) $(CCFLAGS) -r $< -o $@ -user/%: src/userland/% - @echo "compiling userspace program $<" - @make -C $< +userPrograms: + @make --silent -C src/userland hlib: - @echo "compiling userspace honey-os library" - @make -C src/hlib + @make --silent -C src/hlib clean: @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) initrd src/userland/*/build + @rm -r $(BUILD_FOLDER) initrd src/userland/build diff --git a/src/userland/Makefile b/src/userland/Makefile new file mode 100644 index 0000000..24e4916 --- /dev/null +++ b/src/userland/Makefile @@ -0,0 +1,41 @@ +CC = i686-elf-gcc +CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero +LD = i686-elf-ld +LD_FLAGS = -z max-page-size=0x1000 -T link.ld --no-warn-rwx-segment +AS = nasm +ASFlAGS = -felf32 + +SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) +OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) + +PROGRAM_NAMES := $(shell ls -d */ | sed "s/\/$$//" | sed "s|build||") +PROGRAMS := $(PROGRAM_NAMES:%=../../initrd/%) + +all: $(PROGRAMS) + +.SUFFIXES: + +define MAKE_PROGRAM + +../../initrd/$(1): $(2) + @echo "linking $(1) from $$^" + @$(LD) $(LD_FLAGS) -o $$@ $$^ + +build/$(1)/%.c.o: $(1)/%.c + @echo "compiling '$$<' to '$$@' for $(1)" + @mkdir -p $$(dir $$@) + @$(CC) $(CCFLAGS) $$< -o $$@ -I $(1)/include + +endef + +$(foreach NAME, $(PROGRAM_NAMES), $(eval $(call MAKE_PROGRAM,$(NAME),$(shell find $(NAME) -name "*.c" | sed "s|$$|.o|" | sed "s|^|build/|")))) + + +# $(shell find $(subst user/,,$@) -name "*.c" | sed "s?/\([^/]*\)?/build/\1?") +#user/%: $$(shell echo "test") +# NAME=$$(echo $@ | sed "s?user/??"); \ +# SOURCES=$$(find $$NAME -name "*.c"); \ +# OBJS=$$(echo $$SOURCES | sed "s|$$|.o|" | sed "s|^|build/|"); \ +# make $$OBJS;\ +# echo "linking $@ $<";\ +# $(LD) $(LD_FLAGS) -I include$$NAME -o ../../initrd/$$NAME diff --git a/src/userland/crashTest/Makefile b/src/userland/crashTest/Makefile deleted file mode 100644 index 9be876f..0000000 --- a/src/userland/crashTest/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/crashTest: $(OBJS) ../../../build/hlib.o - @echo "linking user programm crash test" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/hid/Makefile b/src/userland/hid/Makefile deleted file mode 100644 index 81bcd9d..0000000 --- a/src/userland/hid/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name "*.c" -or -name "*.asm" -or -name "*.s") -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = hid - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/ioManager/Makefile b/src/userland/ioManager/Makefile deleted file mode 100644 index 0b0ac8e..0000000 --- a/src/userland/ioManager/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/ioManager: $(OBJS) ../../../build/hlib.o - @echo "linking user program io manager" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/keyboard/Makefile b/src/userland/keyboard/Makefile deleted file mode 100644 index 99ace25..0000000 --- a/src/userland/keyboard/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/keyboard: $(OBJS) ../../../build/hlib.o - @echo "linking user program PS/2 keyboard" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/link.ld b/src/userland/link.ld index cd5fb81..f9cdecc 100644 --- a/src/userland/link.ld +++ b/src/userland/link.ld @@ -1,7 +1,7 @@ OUTPUT_ARCH(i386) ENTRY(main) -INPUT( ../../../build/hlib.o) +INPUT( ../../build/hlib.o) SECTIONS { . = 0x80000000; diff --git a/src/userland/loader/Makefile b/src/userland/loader/Makefile deleted file mode 100644 index 2c52ec5..0000000 --- a/src/userland/loader/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/loader: $(OBJS) ../../../build/hlib.o - @echo "linking user program loader" - @$(LD) $(LD_FLAGS) -o ../../../initrd/loader $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/log/Makefile b/src/userland/log/Makefile deleted file mode 100644 index fb17fcb..0000000 --- a/src/userland/log/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/log: $(OBJS) ../../../build/hlib.o - @echo "linking user program log" - @$(LD) $(LD_FLAGS) -o ../../../initrd/log $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/lspci/Makefile b/src/userland/lspci/Makefile deleted file mode 100644 index 4dff6a0..0000000 --- a/src/userland/lspci/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = lspci - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/mouse/Makefile b/src/userland/mouse/Makefile deleted file mode 100644 index 4dd1acb..0000000 --- a/src/userland/mouse/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = mouse - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/parallel/Makefile b/src/userland/parallel/Makefile deleted file mode 100644 index 308795d..0000000 --- a/src/userland/parallel/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = parallel - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/pic/Makefile b/src/userland/pic/Makefile deleted file mode 100644 index 573d46d..0000000 --- a/src/userland/pic/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/pic: $(OBJS) ../../../build/hlib.o - @echo "linking user program 8259 PIC" - @$(LD) $(LD_FLAGS) -o ../../../initrd/pic $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/pit/Makefile b/src/userland/pit/Makefile deleted file mode 100644 index ad7d5fd..0000000 --- a/src/userland/pit/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = pit - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/ps2/Makefile b/src/userland/ps2/Makefile deleted file mode 100644 index a5855c4..0000000 --- a/src/userland/ps2/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = ps2 - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/shell/Makefile b/src/userland/shell/Makefile deleted file mode 100644 index cc7b87e..0000000 --- a/src/userland/shell/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/shell: $(OBJS) ../../../build/hlib.o - @echo "linking user program shell" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/Makefile b/Makefile index 6a72399..4c5fa9c 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,8 @@ SOURCE_FILES := $(shell find src/kernel -name *.c -or -name *.asm -or -name *.s) OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) -USER_PROGRAMS := $(shell tree -d -L 1 -i --noreport src/userland/ | tail -n+2) -USER_PROGRAM_NAMES := $(USER_PROGRAMS:%=user/%) -USER_PROGRAM_FILES := $(USER_PROGRAMS:%=initrd/%) -run: build initrd hlib $(USER_PROGRAM_NAMES) $(IMAGE_FILE) +run: build initrd hlib userPrograms $(IMAGE_FILE) @echo "starting qemu" @$(EMU) $(EMUFLAGS) @@ -67,14 +64,12 @@ @mkdir -p $(dir $@) @$(CC) $(CCFLAGS) -r $< -o $@ -user/%: src/userland/% - @echo "compiling userspace program $<" - @make -C $< +userPrograms: + @make --silent -C src/userland hlib: - @echo "compiling userspace honey-os library" - @make -C src/hlib + @make --silent -C src/hlib clean: @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) initrd src/userland/*/build + @rm -r $(BUILD_FOLDER) initrd src/userland/build diff --git a/src/userland/Makefile b/src/userland/Makefile new file mode 100644 index 0000000..24e4916 --- /dev/null +++ b/src/userland/Makefile @@ -0,0 +1,41 @@ +CC = i686-elf-gcc +CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero +LD = i686-elf-ld +LD_FLAGS = -z max-page-size=0x1000 -T link.ld --no-warn-rwx-segment +AS = nasm +ASFlAGS = -felf32 + +SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) +OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) + +PROGRAM_NAMES := $(shell ls -d */ | sed "s/\/$$//" | sed "s|build||") +PROGRAMS := $(PROGRAM_NAMES:%=../../initrd/%) + +all: $(PROGRAMS) + +.SUFFIXES: + +define MAKE_PROGRAM + +../../initrd/$(1): $(2) + @echo "linking $(1) from $$^" + @$(LD) $(LD_FLAGS) -o $$@ $$^ + +build/$(1)/%.c.o: $(1)/%.c + @echo "compiling '$$<' to '$$@' for $(1)" + @mkdir -p $$(dir $$@) + @$(CC) $(CCFLAGS) $$< -o $$@ -I $(1)/include + +endef + +$(foreach NAME, $(PROGRAM_NAMES), $(eval $(call MAKE_PROGRAM,$(NAME),$(shell find $(NAME) -name "*.c" | sed "s|$$|.o|" | sed "s|^|build/|")))) + + +# $(shell find $(subst user/,,$@) -name "*.c" | sed "s?/\([^/]*\)?/build/\1?") +#user/%: $$(shell echo "test") +# NAME=$$(echo $@ | sed "s?user/??"); \ +# SOURCES=$$(find $$NAME -name "*.c"); \ +# OBJS=$$(echo $$SOURCES | sed "s|$$|.o|" | sed "s|^|build/|"); \ +# make $$OBJS;\ +# echo "linking $@ $<";\ +# $(LD) $(LD_FLAGS) -I include$$NAME -o ../../initrd/$$NAME diff --git a/src/userland/crashTest/Makefile b/src/userland/crashTest/Makefile deleted file mode 100644 index 9be876f..0000000 --- a/src/userland/crashTest/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/crashTest: $(OBJS) ../../../build/hlib.o - @echo "linking user programm crash test" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/hid/Makefile b/src/userland/hid/Makefile deleted file mode 100644 index 81bcd9d..0000000 --- a/src/userland/hid/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name "*.c" -or -name "*.asm" -or -name "*.s") -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = hid - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/ioManager/Makefile b/src/userland/ioManager/Makefile deleted file mode 100644 index 0b0ac8e..0000000 --- a/src/userland/ioManager/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/ioManager: $(OBJS) ../../../build/hlib.o - @echo "linking user program io manager" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/keyboard/Makefile b/src/userland/keyboard/Makefile deleted file mode 100644 index 99ace25..0000000 --- a/src/userland/keyboard/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/keyboard: $(OBJS) ../../../build/hlib.o - @echo "linking user program PS/2 keyboard" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/link.ld b/src/userland/link.ld index cd5fb81..f9cdecc 100644 --- a/src/userland/link.ld +++ b/src/userland/link.ld @@ -1,7 +1,7 @@ OUTPUT_ARCH(i386) ENTRY(main) -INPUT( ../../../build/hlib.o) +INPUT( ../../build/hlib.o) SECTIONS { . = 0x80000000; diff --git a/src/userland/loader/Makefile b/src/userland/loader/Makefile deleted file mode 100644 index 2c52ec5..0000000 --- a/src/userland/loader/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/loader: $(OBJS) ../../../build/hlib.o - @echo "linking user program loader" - @$(LD) $(LD_FLAGS) -o ../../../initrd/loader $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/log/Makefile b/src/userland/log/Makefile deleted file mode 100644 index fb17fcb..0000000 --- a/src/userland/log/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/log: $(OBJS) ../../../build/hlib.o - @echo "linking user program log" - @$(LD) $(LD_FLAGS) -o ../../../initrd/log $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/lspci/Makefile b/src/userland/lspci/Makefile deleted file mode 100644 index 4dff6a0..0000000 --- a/src/userland/lspci/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = lspci - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/mouse/Makefile b/src/userland/mouse/Makefile deleted file mode 100644 index 4dd1acb..0000000 --- a/src/userland/mouse/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = mouse - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/parallel/Makefile b/src/userland/parallel/Makefile deleted file mode 100644 index 308795d..0000000 --- a/src/userland/parallel/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = parallel - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/pic/Makefile b/src/userland/pic/Makefile deleted file mode 100644 index 573d46d..0000000 --- a/src/userland/pic/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/pic: $(OBJS) ../../../build/hlib.o - @echo "linking user program 8259 PIC" - @$(LD) $(LD_FLAGS) -o ../../../initrd/pic $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/pit/Makefile b/src/userland/pit/Makefile deleted file mode 100644 index ad7d5fd..0000000 --- a/src/userland/pit/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = pit - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/ps2/Makefile b/src/userland/ps2/Makefile deleted file mode 100644 index a5855c4..0000000 --- a/src/userland/ps2/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = ps2 - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/shell/Makefile b/src/userland/shell/Makefile deleted file mode 100644 index cc7b87e..0000000 --- a/src/userland/shell/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/shell: $(OBJS) ../../../build/hlib.o - @echo "linking user program shell" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/usb/Makefile b/src/userland/usb/Makefile deleted file mode 100644 index ceb41ed..0000000 --- a/src/userland/usb/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = usb - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/Makefile b/Makefile index 6a72399..4c5fa9c 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,8 @@ SOURCE_FILES := $(shell find src/kernel -name *.c -or -name *.asm -or -name *.s) OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) -USER_PROGRAMS := $(shell tree -d -L 1 -i --noreport src/userland/ | tail -n+2) -USER_PROGRAM_NAMES := $(USER_PROGRAMS:%=user/%) -USER_PROGRAM_FILES := $(USER_PROGRAMS:%=initrd/%) -run: build initrd hlib $(USER_PROGRAM_NAMES) $(IMAGE_FILE) +run: build initrd hlib userPrograms $(IMAGE_FILE) @echo "starting qemu" @$(EMU) $(EMUFLAGS) @@ -67,14 +64,12 @@ @mkdir -p $(dir $@) @$(CC) $(CCFLAGS) -r $< -o $@ -user/%: src/userland/% - @echo "compiling userspace program $<" - @make -C $< +userPrograms: + @make --silent -C src/userland hlib: - @echo "compiling userspace honey-os library" - @make -C src/hlib + @make --silent -C src/hlib clean: @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) initrd src/userland/*/build + @rm -r $(BUILD_FOLDER) initrd src/userland/build diff --git a/src/userland/Makefile b/src/userland/Makefile new file mode 100644 index 0000000..24e4916 --- /dev/null +++ b/src/userland/Makefile @@ -0,0 +1,41 @@ +CC = i686-elf-gcc +CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero +LD = i686-elf-ld +LD_FLAGS = -z max-page-size=0x1000 -T link.ld --no-warn-rwx-segment +AS = nasm +ASFlAGS = -felf32 + +SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) +OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) + +PROGRAM_NAMES := $(shell ls -d */ | sed "s/\/$$//" | sed "s|build||") +PROGRAMS := $(PROGRAM_NAMES:%=../../initrd/%) + +all: $(PROGRAMS) + +.SUFFIXES: + +define MAKE_PROGRAM + +../../initrd/$(1): $(2) + @echo "linking $(1) from $$^" + @$(LD) $(LD_FLAGS) -o $$@ $$^ + +build/$(1)/%.c.o: $(1)/%.c + @echo "compiling '$$<' to '$$@' for $(1)" + @mkdir -p $$(dir $$@) + @$(CC) $(CCFLAGS) $$< -o $$@ -I $(1)/include + +endef + +$(foreach NAME, $(PROGRAM_NAMES), $(eval $(call MAKE_PROGRAM,$(NAME),$(shell find $(NAME) -name "*.c" | sed "s|$$|.o|" | sed "s|^|build/|")))) + + +# $(shell find $(subst user/,,$@) -name "*.c" | sed "s?/\([^/]*\)?/build/\1?") +#user/%: $$(shell echo "test") +# NAME=$$(echo $@ | sed "s?user/??"); \ +# SOURCES=$$(find $$NAME -name "*.c"); \ +# OBJS=$$(echo $$SOURCES | sed "s|$$|.o|" | sed "s|^|build/|"); \ +# make $$OBJS;\ +# echo "linking $@ $<";\ +# $(LD) $(LD_FLAGS) -I include$$NAME -o ../../initrd/$$NAME diff --git a/src/userland/crashTest/Makefile b/src/userland/crashTest/Makefile deleted file mode 100644 index 9be876f..0000000 --- a/src/userland/crashTest/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -Wno-div-by-zero -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/crashTest: $(OBJS) ../../../build/hlib.o - @echo "linking user programm crash test" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/hid/Makefile b/src/userland/hid/Makefile deleted file mode 100644 index 81bcd9d..0000000 --- a/src/userland/hid/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name "*.c" -or -name "*.asm" -or -name "*.s") -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = hid - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/ioManager/Makefile b/src/userland/ioManager/Makefile deleted file mode 100644 index 0b0ac8e..0000000 --- a/src/userland/ioManager/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/ioManager: $(OBJS) ../../../build/hlib.o - @echo "linking user program io manager" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/keyboard/Makefile b/src/userland/keyboard/Makefile deleted file mode 100644 index 99ace25..0000000 --- a/src/userland/keyboard/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/keyboard: $(OBJS) ../../../build/hlib.o - @echo "linking user program PS/2 keyboard" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/link.ld b/src/userland/link.ld index cd5fb81..f9cdecc 100644 --- a/src/userland/link.ld +++ b/src/userland/link.ld @@ -1,7 +1,7 @@ OUTPUT_ARCH(i386) ENTRY(main) -INPUT( ../../../build/hlib.o) +INPUT( ../../build/hlib.o) SECTIONS { . = 0x80000000; diff --git a/src/userland/loader/Makefile b/src/userland/loader/Makefile deleted file mode 100644 index 2c52ec5..0000000 --- a/src/userland/loader/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/loader: $(OBJS) ../../../build/hlib.o - @echo "linking user program loader" - @$(LD) $(LD_FLAGS) -o ../../../initrd/loader $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/log/Makefile b/src/userland/log/Makefile deleted file mode 100644 index fb17fcb..0000000 --- a/src/userland/log/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/log: $(OBJS) ../../../build/hlib.o - @echo "linking user program log" - @$(LD) $(LD_FLAGS) -o ../../../initrd/log $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/lspci/Makefile b/src/userland/lspci/Makefile deleted file mode 100644 index 4dff6a0..0000000 --- a/src/userland/lspci/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = lspci - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/mouse/Makefile b/src/userland/mouse/Makefile deleted file mode 100644 index 4dd1acb..0000000 --- a/src/userland/mouse/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = mouse - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/parallel/Makefile b/src/userland/parallel/Makefile deleted file mode 100644 index 308795d..0000000 --- a/src/userland/parallel/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = parallel - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/pic/Makefile b/src/userland/pic/Makefile deleted file mode 100644 index 573d46d..0000000 --- a/src/userland/pic/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/pic: $(OBJS) ../../../build/hlib.o - @echo "linking user program 8259 PIC" - @$(LD) $(LD_FLAGS) -o ../../../initrd/pic $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/pit/Makefile b/src/userland/pit/Makefile deleted file mode 100644 index ad7d5fd..0000000 --- a/src/userland/pit/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = pit - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/ps2/Makefile b/src/userland/ps2/Makefile deleted file mode 100644 index a5855c4..0000000 --- a/src/userland/ps2/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = ps2 - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/shell/Makefile b/src/userland/shell/Makefile deleted file mode 100644 index cc7b87e..0000000 --- a/src/userland/shell/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/shell: $(OBJS) ../../../build/hlib.o - @echo "linking user program shell" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/usb/Makefile b/src/userland/usb/Makefile deleted file mode 100644 index ceb41ed..0000000 --- a/src/userland/usb/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name "*.c" -or -name *.asm -or -name *.s) -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -NAME = usb - -../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o - @echo "linking user program $(NAME)" - @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER) diff --git a/src/userland/vga/Makefile b/src/userland/vga/Makefile deleted file mode 100644 index 4fd29b8..0000000 --- a/src/userland/vga/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -CC = i686-elf-gcc -CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0 -LD = i686-elf-ld -LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld -AS = nasm -ASFlAGS = -felf32 - -BUILD_FOLDER = build - -SOURCE_FILES := $(shell find . -name '*.c' -or -name '*.asm' -or -name '*.s') -OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o) - -../../../initrd/vga: $(OBJS) ../../../build/hlib.o - @echo "linking user program vga driver" - @$(LD) $(LD_FLAGS) -o $@ $(OBJS) - -$(BUILD_FOLDER)/%.asm.o: %.asm - @echo "asembling $<" - @mkdir -p $(dir $@) - @$(AS) $(ASFlAGS) $< -o $@ - -$(BUILD_FOLDER)/%.c.o: %.c - @echo "compiling $<" - @mkdir -p $(dir $@) - @$(CC) $(CCFLAGS) -r $< -o $@ - -clean: - @echo "clearing build folder" - @rm -r $(BUILD_FOLDER)