]> Chaos Git - corbenik/ctrulib.git/commitdiff
Moved service source-files into source/services/.
authorplutoo <plutoo@univor.se>
Mon, 28 Jul 2014 20:04:31 +0000 (22:04 +0200)
committerplutoo <plutoo@univor.se>
Mon, 28 Jul 2014 20:04:31 +0000 (22:04 +0200)
16 files changed:
libctru/Makefile
libctru/source/services/ac.c [moved from libctru/source/AC.c with 100% similarity]
libctru/source/services/apt.c [moved from libctru/source/APT.c with 100% similarity]
libctru/source/services/cfgnor.c [moved from libctru/source/CFGNOR.c with 100% similarity]
libctru/source/services/csnd.c [moved from libctru/source/CSND.c with 100% similarity]
libctru/source/services/fs.c [moved from libctru/source/FS.c with 100% similarity]
libctru/source/services/gpu.c [moved from libctru/source/GPU.c with 100% similarity]
libctru/source/services/gpuResetSequence.c [moved from libctru/source/gpuResetSequence.c with 100% similarity]
libctru/source/services/gsp.c [moved from libctru/source/GSP.c with 100% similarity]
libctru/source/services/gx.c [moved from libctru/source/GX.c with 100% similarity]
libctru/source/services/hid.c [moved from libctru/source/HID.c with 100% similarity]
libctru/source/services/httpc.c [moved from libctru/source/HTTPC.c with 100% similarity]
libctru/source/services/ir.c [moved from libctru/source/IR.c with 100% similarity]
libctru/source/services/os.c [moved from libctru/source/OS.c with 100% similarity]
libctru/source/services/shdr.c [moved from libctru/source/SHDR.c with 100% similarity]
libctru/source/services/soc.c [moved from libctru/source/SOC.c with 100% similarity]

index 92c78e4dfab22243cbbf3aaa35e3532532c9083a..5dd829b71b711d55d2a161a937c0eaf12ceb63e6 100644 (file)
-CC = arm-none-eabi-gcc
-AR = arm-none-eabi-ar
-CFLAGS += -Wall -std=c99 -march=armv6 -O0 -I"$(CURDIR)/include/"
+#---------------------------------------------------------------------------------
+.SUFFIXES:
+#---------------------------------------------------------------------------------
 
-CFILES = $(wildcard source/*.c)
-OFILES = $(CFILES:source/%.c=build/%.o)
-DFILES = $(CFILES:source/%.c=build/%.d)
-SFILES = $(wildcard source/*.s)
-OFILES += $(SFILES:source/%.s=build/%.o)
-PROJECTNAME = "libctru"
+ifeq ($(strip $(DEVKITARM)),)
+$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
+endif
 
-.PHONY:=all dir
+include $(DEVKITARM)/base_rules
 
-all: dir lib/$(PROJECTNAME).a
+#---------------------------------------------------------------------------------
+# TARGET is the name of the output
+# BUILD is the directory where object files & intermediate files will be placed
+# SOURCES is a list of directories containing source code
+# DATA is a list of directories containing data files
+# INCLUDES is a list of directories containing header files
+#---------------------------------------------------------------------------------
+TARGET         :=      ctru
+BUILD          :=      build
+SOURCES                :=      source source/services
+DATA           :=      data
+INCLUDES       :=      include
 
-dir:
-       mkdir -p build
-       mkdir -p lib
+#---------------------------------------------------------------------------------
+# options for code generation
+#---------------------------------------------------------------------------------
+ARCH   :=      -marm
 
-lib/$(PROJECTNAME).a: $(OFILES)
-       $(AR) rvs $@ $^
+CFLAGS :=      -g -Wall -O2 -mthumb-interwork\
+               -mcpu=mpcore -mtune=mpcore \
+               -mfpu=vfp -ffast-math -mword-relocations \
+               $(ARCH)
 
+CFLAGS +=      $(INCLUDE) -DARM11 -D_3DS
+CXXFLAGS       := $(CFLAGS) -fno-rtti -fno-exceptions
+
+ASFLAGS        :=      -g $(ARCH) -mcpu=mpcore -mtune=mpcore
+LDFLAGS        =       -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
+
+#---------------------------------------------------------------------------------
+# list of directories containing libraries, this must be the top level containing
+# include and lib
+#---------------------------------------------------------------------------------
+LIBDIRS        :=
+
+#---------------------------------------------------------------------------------
+# no real need to edit anything past this point unless you need to add additional
+# rules for different file extensions
+#---------------------------------------------------------------------------------
+ifneq ($(BUILD),$(notdir $(CURDIR)))
+#---------------------------------------------------------------------------------
+
+export OUTPUT  :=      $(CURDIR)/lib/lib$(TARGET).a
+
+export VPATH   :=      $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
+                       $(foreach dir,$(DATA),$(CURDIR)/$(dir))
+
+export DEPSDIR :=      $(CURDIR)/$(BUILD)
+
+CFILES         :=      $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
+CPPFILES       :=      $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
+SFILES         :=      $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
+BINFILES       :=      $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
+
+#---------------------------------------------------------------------------------
+# use CXX for linking C++ projects, CC for standard C
+#---------------------------------------------------------------------------------
+ifeq ($(strip $(CPPFILES)),)
+#---------------------------------------------------------------------------------
+       export LD       :=      $(CC)
+#---------------------------------------------------------------------------------
+else
+#---------------------------------------------------------------------------------
+       export LD       :=      $(CXX)
+#---------------------------------------------------------------------------------
+endif
+#---------------------------------------------------------------------------------
+
+export OFILES  :=      $(addsuffix .o,$(BINFILES)) \
+                       $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
+
+export INCLUDE :=      $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
+                       $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
+                       -I$(CURDIR)/$(BUILD)
+
+.PHONY: $(BUILD) clean all
+
+#---------------------------------------------------------------------------------
+all: $(BUILD)
+
+lib:
+       @[ -d $@ ] || mkdir -p $@
+
+$(BUILD): lib
+       @[ -d $@ ] || mkdir -p $@
+       @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
+
+#---------------------------------------------------------------------------------
 clean:
-       @rm -f build/*.o build/*.d
-       @rm -f $(PROJECTNAME).a
-       @echo "all cleaned up !"
+       @echo clean ...
+       @rm -fr $(BUILD) lib
+
+#---------------------------------------------------------------------------------
+else
+
+DEPENDS        :=      $(OFILES:.o=.d)
+
+#---------------------------------------------------------------------------------
+# main targets
+#---------------------------------------------------------------------------------
+$(OUTPUT)      :       $(OFILES)
+
+#---------------------------------------------------------------------------------
+%.bin.o        :       %.bin
+#---------------------------------------------------------------------------------
+       @echo $(notdir $<)
+       @$(bin2o)
 
--include $(DFILES)
 
-build/%.o: source/%.c
-       $(CC) $(CFLAGS) -c $< -o $@
-       @$(CC) -MM $< > build/$*.d
+-include $(DEPENDS)
 
-build/%.o: source/%.s
-       $(CC) $(CFLAGS) -c $< -o $@
-       @$(CC) -MM $< > build/$*.d
+#---------------------------------------------------------------------------------------
+endif
+#---------------------------------------------------------------------------------------