cynix

x86 UNIX-like OS
git clone git://git.2f30.org/cynix
Log | Files | Refs | README | LICENSE

Makefile (1211B)


      1 # root Makefile for cynix
      2 
      3 MAKEFLAGS += -rR --no-print-directory
      4 bin = build/kernel
      5 inc = -Isrc/include -Isrc/libc
      6 CC = gcc
      7 CFLAGS = -std=gnu99 -m32 -Wall -Wextra -Wformat-security -Wshadow \
      8 	-Wunreachable-code -Wpointer-arith -g -nostdlib -nostdinc \
      9 	-nodefaultlibs -nostartfiles -fno-builtin $(inc)
     10 ASFLAGS = -m32 -g -nostdlib -nostdinc -nodefaultlibs -nostartfiles \
     11 	-fno-builtin $(inc)
     12 LDFLAGS = -m elf_i386 -Tbuild/link.ld
     13 logo = "build/logo"
     14 
     15 include src/boot/Makefile-part
     16 include src/core/Makefile-part
     17 include src/libc/Makefile-part
     18 
     19 $(bin): $(obj)
     20 	@echo -e "  LD\t"$@
     21 	@ld $(LDFLAGS) -o $@ $(obj)
     22 	@echo "  Generating kernel.sym"
     23 	@nm build/kernel | sort > build/kernel.sym
     24 	@echo -e "\nHere comes the dopefish!"
     25 	@cat $(logo)
     26 	@tput sgr0
     27 
     28 %.o: %.c
     29 	@echo -e "  CC\t"$<
     30 	@$(CC) $(CFLAGS) -c -o $@ $<
     31 
     32 %.o: %.S
     33 	@echo -e "  CC\t"$<
     34 	@$(CC) $(ASFLAGS) -c -o $@ $<
     35 
     36 .PHONY: install
     37 install:
     38 	@pushd build && ./mkcreateimg.sh && ./installimg.sh && popd
     39 
     40 .PHONY: clean
     41 clean:
     42 	@rm -rf $(obj) build/kernel* build/image.img build/iso build/cynix.iso
     43 
     44 .PHONY: boot
     45 boot:
     46 	@pushd build && ./run.sh && popd
     47 
     48 .PHONY: pack
     49 dist:
     50 	@tar cfz ../cynix.tar.gz .
     51 
     52 .PHONY: all
     53 all:
     54 	@make clean && make && make boot