2019-12-12 14:29:37 +00:00
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# pull in common atmosphere configuration
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../config/common.mk
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# options for code generation
|
|
|
|
#---------------------------------------------------------------------------------
|
2020-05-11 23:02:10 +01:00
|
|
|
PRECOMPILED_HEADERS := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/include/mesosphere.hpp
|
2020-02-19 09:22:51 +00:00
|
|
|
|
2019-12-12 14:29:37 +00:00
|
|
|
DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_MESOSPHERE
|
2020-08-17 22:20:24 +01:00
|
|
|
SETTINGS := $(ATMOSPHERE_SETTINGS) -O2 -mgeneral-regs-only -ffixed-x18 -Wextra -Werror -fno-non-call-exceptions
|
2019-12-12 14:29:37 +00:00
|
|
|
CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
2020-01-31 12:47:08 +00:00
|
|
|
CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -fno-use-cxa-atexit -flto
|
2019-12-12 14:29:37 +00:00
|
|
|
ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS)
|
|
|
|
|
2020-02-23 14:51:32 +00:00
|
|
|
SOURCES += $(call ALL_SOURCE_DIRS,../libvapours/source)
|
|
|
|
|
2019-12-12 14:29:37 +00:00
|
|
|
LIBS :=
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# list of directories containing libraries, this must be the top level containing
|
|
|
|
# include and lib
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
LIBDIRS := $(ATMOSPHERE_LIBRARIES_DIR)/libvapours
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# no real need to edit anything past this point unless you need to add additional
|
|
|
|
# rules for different file extensions
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
|
2020-02-19 09:22:51 +00:00
|
|
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
2019-12-12 14:29:37 +00:00
|
|
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
|
|
|
2020-08-11 19:22:56 +01:00
|
|
|
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
|
|
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
|
|
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
2019-12-12 14:29:37 +00:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# use CXX for linking C++ projects, CC for standard C
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
ifeq ($(strip $(CPPFILES)),)
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
export LD := $(CC)
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
else
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
export LD := $(CXX)
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
endif
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
|
|
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
2020-02-19 09:22:51 +00:00
|
|
|
export GCH_FILES := $(foreach hdr,$(PRECOMPILED_HEADERS:.hpp=.gch),$(notdir $(hdr)))
|
2019-12-12 14:29:37 +00:00
|
|
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
2019-12-17 22:16:08 +00:00
|
|
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
2019-12-12 14:29:37 +00:00
|
|
|
|
|
|
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
|
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
|
|
-I.
|
|
|
|
|
|
|
|
.PHONY: clean all
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
all: lib/$(TARGET).a
|
|
|
|
|
|
|
|
lib:
|
|
|
|
@[ -d $@ ] || mkdir -p $@
|
|
|
|
|
|
|
|
release:
|
|
|
|
@[ -d $@ ] || mkdir -p $@
|
|
|
|
|
|
|
|
lib/$(TARGET).a : lib release $(SOURCES) $(INCLUDES)
|
|
|
|
@$(MAKE) BUILD=release OUTPUT=$(CURDIR)/$@ \
|
|
|
|
BUILD_CFLAGS="-DNDEBUG=1 -O2" \
|
|
|
|
DEPSDIR=$(CURDIR)/release \
|
|
|
|
--no-print-directory -C release \
|
|
|
|
-f $(CURDIR)/Makefile
|
|
|
|
|
|
|
|
dist-bin: all
|
|
|
|
@tar --exclude=*~ -cjf $(TARGET).tar.bz2 include lib
|
|
|
|
|
|
|
|
dist-src:
|
|
|
|
@tar --exclude=*~ -cjf $(TARGET)-src.tar.bz2 include source Makefile
|
|
|
|
|
|
|
|
dist: dist-src dist-bin
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
clean:
|
|
|
|
@echo clean ...
|
|
|
|
@rm -fr release lib *.bz2
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
else
|
|
|
|
|
2020-02-19 09:22:51 +00:00
|
|
|
DEPENDS := $(OFILES:.o=.d) $(GCH_FILES:.gch=.d)
|
2019-12-12 14:29:37 +00:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# main targets
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
$(OUTPUT) : $(OFILES)
|
|
|
|
|
2020-02-19 09:22:51 +00:00
|
|
|
$(filter-out kern_svc_tables.o, $(OFILES)) : $(GCH_FILES)
|
|
|
|
|
2019-12-17 22:16:08 +00:00
|
|
|
$(OFILES_SRC) : $(HFILES_BIN)
|
2019-12-12 14:29:37 +00:00
|
|
|
|
2020-05-11 23:02:10 +01:00
|
|
|
kern_libc_generic.o: CFLAGS += -fno-builtin
|
|
|
|
|
2019-12-12 14:29:37 +00:00
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
%_bin.h %.bin.o : %.bin
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
@echo $(notdir $<)
|
|
|
|
@$(bin2o)
|
|
|
|
|
|
|
|
|
|
|
|
-include $(DEPENDS)
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------------
|
|
|
|
endif
|
|
|
|
#---------------------------------------------------------------------------------------
|
|
|
|
|