aboutsummaryrefslogblamecommitdiff
path: root/lib/Makefile
blob: c85d450af0a39672f90b134c34fec5517eff3c3f (plain) (tree)
1
2
3
4
5
6
7
8

                                    



                            

                            


                        
                  
                        
                                    
                
                       
 






                                                                                   

         
                                                  

        
                                     

      
                             
                         

                
# Copyright (c) 2020 Johannes Stoelp

ARCH ?= x86_64

ifeq ($(ARCH),arm64)
PREFIX := aarch64-linux-gnu-
else ifeq ($(ARCH),arm)
PREFIX := arm-linux-gnueabi-
endif

AS       := $(PREFIX)gcc
ASFLAGS  := -g -O0
CXX      := $(PREFIX)g++
CXXFLAGS := -g -O0 -Wall -Wextra -I.
DEPS_GEN := -MMD
AR       := $(PREFIX)ar

OBJS := thread.o executor.o
OBJS += arch/$(ARCH)/thread_create.o arch/$(ARCH)/yield.o arch/$(ARCH)/init_stack.o

DEPS := $(OBJS:%.o=%.d)

libmatcha.a: $(OBJS)
	$(AR) rcs $@ $^

%.o: %.cc
	$(CXX) -c -o $@ $(CXXFLAGS) $(DEPS_GEN) $<

%.o: %.s
	$(AS) -c -o $@ $(ASFLAGS) $< 

clean:
	rm -f $(OBJS) $(DEPS)
	rm -f libmatcha.a

-include $(DEPS)