summaryrefslogblamecommitdiff
path: root/src/common.make
blob: be6a3029bb7392dee14bbaa76d034e851dec5487 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11


                                      
                                                                                                  

                  
                                                                                              



                       
                             









                                         
                                           

















                                             




                                                
# ============== ENVIRONMENT VARIABLES

CC = i586-elf-gcc
CFLAGS = -nostdlib -nostartfiles -nodefaultlibs -fno-builtin -fno-stack-protector -Wall -Wextra -g
CCFLAGS = 
CXX = i586-elf-g++
CXXFLAGS = -fno-rtti -fno-exceptions -Werror -Wno-write-strings -Wno-error=unused-parameter -g

LD = i586-elf-ld
.PHONY: clean, mrproper

LDFLAGS = -oformat=elf32-i386

ASM = nasm
AFLAGS = -f elf

# ============== GENERAL BUILD PROCEDURES

all: $(Out)

$(Out): $(Obj)
	echo ""; echo "- Linking $@..."
	$(LD) $(LDFLAGS) $^ -o $@ $(ExtObj)

# ============== GENERAL CLEAINING PROCEDURES

clean:
	rm $(Obj) || exit 0
	rm *.o */*.o || exit 0

mrproper: clean
	rm $(Out) || exit 0

# ============== SOURCE FILE BUILD PROCEDURES

%.o: %.asm
	echo ""; echo "- $<"
	$(ASM) $(AFLAGS) -o $@ $<
	
%.o: %.c
	echo ""; echo "- $<"
	$(CC) -c $< -o $@ $(CFLAGS) $(CCFLAGS)

%.o: %.cpp
	echo ""; echo "- $<"
	$(CXX) -c $< -o $@ $(CFLAGS) $(CXXFLAGS)