|
@@ -0,0 +1,78 @@
|
|
|
+#
|
|
|
+# Makefile
|
|
|
+#
|
|
|
+# Copyright (C) 2018 Aleksandar Andrejevic <theflash@sdf.lonestar.org>
|
|
|
+#
|
|
|
+# This program is free software: you can redistribute it and/or modify
|
|
|
+# it under the terms of the GNU Affero General Public License as
|
|
|
+# published by the Free Software Foundation, either version 3 of the
|
|
|
+# License, or (at your option) any later version.
|
|
|
+#
|
|
|
+# This program is distributed in the hope that it will be useful,
|
|
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
+# GNU Affero General Public License for more details.
|
|
|
+#
|
|
|
+# You should have received a copy of the GNU Affero General Public License
|
|
|
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
+#
|
|
|
+
|
|
|
+# Settings
|
|
|
+DEBUG = yes
|
|
|
+
|
|
|
+# Compilers and tools
|
|
|
+CC = i686-elf-gcc
|
|
|
+ASM = nasm
|
|
|
+LINK = i686-elf-ld
|
|
|
+
|
|
|
+# Directories
|
|
|
+SRCDIR = src
|
|
|
+OBJDIR = obj
|
|
|
+DEPDIR = dep
|
|
|
+
|
|
|
+LIBGCC_DIR = $(shell $(CC) -print-file-name=)
|
|
|
+
|
|
|
+# Flags
|
|
|
+CFLAGS = -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I ../.. -I include -I ../../kernel/include -I ../../crt/include
|
|
|
+ASMFLAGS = -felf
|
|
|
+LDFLAGS = -shared
|
|
|
+
|
|
|
+ifeq ($(DEBUG), yes)
|
|
|
+ CFLAGS += -g
|
|
|
+else
|
|
|
+ CFLAGS += -O3
|
|
|
+endif
|
|
|
+
|
|
|
+# Input and output files
|
|
|
+SOURCES = $(shell find $(SRCDIR) -type f -name \*.c)
|
|
|
+DEPENDS = $(shell find $(DEPDIR) -type f -name \*.d)
|
|
|
+OBJECTS = $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(patsubst $(SRCDIR)/%.asm, $(OBJDIR)/%.o, $(SOURCES)))
|
|
|
+
|
|
|
+.PHONY: all clean
|
|
|
+
|
|
|
+all: $(OBJDIR) $(DEPDIR) acpica.drv
|
|
|
+
|
|
|
+clean:
|
|
|
+ find $(OBJDIR) -name \*.o -delete
|
|
|
+ find $(DEPDIR) -name \*.d -delete
|
|
|
+ rm -f acpica.drv
|
|
|
+
|
|
|
+-include $(DEPENDS)
|
|
|
+
|
|
|
+$(OBJDIR):
|
|
|
+ mkdir -p $(OBJDIR)
|
|
|
+
|
|
|
+$(DEPDIR):
|
|
|
+ mkdir -p $(DEPDIR)
|
|
|
+
|
|
|
+$(OBJDIR)/%.o: $(SRCDIR)/%.c Makefile
|
|
|
+ mkdir -p $(dir $@)
|
|
|
+ mkdir -p $(dir $(@:$(OBJDIR)/%.o=$(DEPDIR)/%.d))
|
|
|
+ $(CC) $(CFLAGS) -MMD -MP -MF $(@:$(OBJDIR)/%.o=$(DEPDIR)/%.d) -o $@ -c $<
|
|
|
+
|
|
|
+$(OBJDIR)/%.o: $(SRCDIR)/%.asm
|
|
|
+ mkdir -p $(dir $@)
|
|
|
+ $(ASM) $(ASMFLAGS) -o $@ $<
|
|
|
+
|
|
|
+acpica.drv: $(OBJECTS)
|
|
|
+ $(LINK) -o $@ $(OBJECTS) $(LDFLAGS)
|