[libcg]modify some directory
This commit is contained in:
parent
7d8a09c837
commit
0160b515ff
|
@ -4,7 +4,6 @@
|
||||||
*.map
|
*.map
|
||||||
*.elf
|
*.elf
|
||||||
*.bin
|
*.bin
|
||||||
*.png
|
|
||||||
*.rej
|
*.rej
|
||||||
*.orig
|
*.orig
|
||||||
*.d
|
*.d
|
||||||
|
@ -16,8 +15,6 @@
|
||||||
#
|
#
|
||||||
# Generated files
|
# Generated files
|
||||||
#
|
#
|
||||||
!/screenshots/*.png
|
|
||||||
/.cproject
|
/.cproject
|
||||||
/.project
|
/.project
|
||||||
/.settings
|
/.settings
|
||||||
/example
|
|
||||||
|
|
77
Makefile
77
Makefile
|
@ -1,76 +1,13 @@
|
||||||
#
|
#
|
||||||
# Makefile for module.
|
# Top Makefile
|
||||||
#
|
#
|
||||||
|
|
||||||
CROSS ?=
|
.PHONY: all clean
|
||||||
|
|
||||||
|
all:
|
||||||
AS := $(CROSS)gcc -x assembler-with-cpp
|
@$(MAKE) -C src all
|
||||||
CC := $(CROSS)gcc
|
@$(MAKE) -C examples all
|
||||||
CXX := $(CROSS)g++
|
|
||||||
LD := $(CROSS)ld
|
|
||||||
AR := $(CROSS)ar
|
|
||||||
OC := $(CROSS)objcopy
|
|
||||||
OD := $(CROSS)objdump
|
|
||||||
RM := rm -fr
|
|
||||||
|
|
||||||
|
|
||||||
ASFLAGS := -g -ggdb -Wall -O3 -ffunction-sections -fdata-sections -ffreestanding -std=gnu99
|
|
||||||
CFLAGS := -g -ggdb -Wall -O3 -ffunction-sections -fdata-sections -ffreestanding -std=gnu99
|
|
||||||
CXXFLAGS := -g -ggdb -Wall -O3 -ffunction-sections -fdata-sections -ffreestanding -std=gnu99
|
|
||||||
LDFLAGS := -Wl,-gc-sections
|
|
||||||
ARFLAGS := -rcs
|
|
||||||
OCFLAGS := -v -O binary
|
|
||||||
ODFLAGS :=
|
|
||||||
MCFLAGS :=
|
|
||||||
|
|
||||||
LIBDIRS :=
|
|
||||||
LIBS := -lm
|
|
||||||
|
|
||||||
INCDIRS := -I .
|
|
||||||
SRCDIRS := .
|
|
||||||
|
|
||||||
SFILES := $(foreach dir, $(SRCDIRS), $(wildcard $(dir)/*.S))
|
|
||||||
CFILES := $(foreach dir, $(SRCDIRS), $(wildcard $(dir)/*.c))
|
|
||||||
CPPFILES := $(foreach dir, $(SRCDIRS), $(wildcard $(dir)/*.cpp))
|
|
||||||
|
|
||||||
SDEPS := $(patsubst %, %, $(SFILES:.S=.o.d))
|
|
||||||
CDEPS := $(patsubst %, %, $(CFILES:.c=.o.d))
|
|
||||||
CPPDEPS := $(patsubst %, %, $(CPPFILES:.cpp=.o.d))
|
|
||||||
DEPS := $(SDEPS) $(CDEPS) $(CPPDEPS)
|
|
||||||
|
|
||||||
SOBJS := $(patsubst %, %, $(SFILES:.S=.o))
|
|
||||||
COBJS := $(patsubst %, %, $(CFILES:.c=.o))
|
|
||||||
CPPOBJS := $(patsubst %, %, $(CPPFILES:.cpp=.o))
|
|
||||||
OBJS := $(SOBJS) $(COBJS) $(CPPOBJS)
|
|
||||||
|
|
||||||
OBJDIRS := $(patsubst %, %, $(SRCDIRS))
|
|
||||||
NAME := example
|
|
||||||
VPATH := $(OBJDIRS)
|
|
||||||
|
|
||||||
.PHONY: all clean
|
|
||||||
|
|
||||||
all : $(NAME)
|
|
||||||
|
|
||||||
$(NAME) : $(OBJS)
|
|
||||||
@echo [LD] Linking $@
|
|
||||||
@$(CC) $(LDFLAGS) $(LIBDIRS) $^ -o $@ $(LIBS)
|
|
||||||
|
|
||||||
$(SOBJS) : %.o : %.S
|
|
||||||
@echo [AS] $<
|
|
||||||
@$(AS) $(ASFLAGS) $(INCDIRS) -c $< -o $@
|
|
||||||
@$(AS) $(ASFLAGS) -MD -MP -MF $@.d $(INCDIRS) -c $< -o $@
|
|
||||||
|
|
||||||
$(COBJS) : %.o : %.c
|
|
||||||
@echo [CC] $<
|
|
||||||
@$(CC) $(CFLAGS) $(INCDIRS) -c $< -o $@
|
|
||||||
@$(CC) $(CFLAGS) -MD -MP -MF $@.d $(INCDIRS) -c $< -o $@
|
|
||||||
|
|
||||||
$(CPPOBJS) : %.o : %.cpp
|
|
||||||
@echo [CXX] $<
|
|
||||||
@$(CXX) $(CXXFLAGS) $(INCDIRS) -c $< -o $@
|
|
||||||
@$(CXX) $(CXXFLAGS) -MD -MP -MF $@.d $(INCDIRS) -c $< -o $@
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@$(RM) $(DEPS) $(OBJS) $(NAME).map $(NAME) *.png *~
|
@$(MAKE) -C src clean
|
||||||
@echo Clean complete.
|
@$(MAKE) -C examples clean
|
||||||
|
|
|
@ -5,8 +5,7 @@ The tiny `C` library of 2D computer graphics.
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
The library's .c and .h files can be dropped into a project and compiled along with it.
|
The library's .c and .h files can be dropped into a project and compiled along with it. Just type `make` at the root directory, you will see a static library and some binary of [examples](examples) for usage.
|
||||||
Just type `make` at the root directory, you will see a example binary file.
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
cd libcg
|
cd libcg
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
#
|
||||||
|
# Normal rules
|
||||||
|
#
|
||||||
|
*.map
|
||||||
|
*.elf
|
||||||
|
*.bin
|
||||||
|
*.png
|
||||||
|
*.rej
|
||||||
|
*.orig
|
||||||
|
*.d
|
||||||
|
*.o
|
||||||
|
*.a
|
||||||
|
*.so
|
||||||
|
*~
|
||||||
|
|
||||||
|
#
|
||||||
|
# Generated files
|
||||||
|
#
|
||||||
|
/examples
|
|
@ -0,0 +1,71 @@
|
||||||
|
#
|
||||||
|
# Makefile for application
|
||||||
|
#
|
||||||
|
|
||||||
|
CROSS_COMPILE ?=
|
||||||
|
|
||||||
|
AS := $(CROSS_COMPILE)gcc -x assembler-with-cpp
|
||||||
|
CC := $(CROSS_COMPILE)gcc
|
||||||
|
CXX := $(CROSS_COMPILE)g++
|
||||||
|
LD := $(CROSS_COMPILE)ld
|
||||||
|
AR := $(CROSS_COMPILE)ar
|
||||||
|
OC := $(CROSS_COMPILE)objcopy
|
||||||
|
OD := $(CROSS_COMPILE)objdump
|
||||||
|
RM := rm -fr
|
||||||
|
|
||||||
|
ASFLAGS := -g -ggdb -Wall -O3
|
||||||
|
CFLAGS := -g -ggdb -Wall -O3
|
||||||
|
CXXFLAGS := -g -ggdb -Wall -O3
|
||||||
|
LDFLAGS :=
|
||||||
|
OCFLAGS := -v -O binary
|
||||||
|
ODFLAGS :=
|
||||||
|
MCFLAGS :=
|
||||||
|
|
||||||
|
LIBDIRS := -L ../src
|
||||||
|
LIBS := -lcg -lm
|
||||||
|
|
||||||
|
INCDIRS := -I . -I ../src
|
||||||
|
SRCDIRS := .
|
||||||
|
|
||||||
|
SFILES := $(foreach dir, $(SRCDIRS), $(wildcard $(dir)/*.S))
|
||||||
|
CFILES := $(foreach dir, $(SRCDIRS), $(wildcard $(dir)/*.c))
|
||||||
|
CPPFILES := $(foreach dir, $(SRCDIRS), $(wildcard $(dir)/*.cpp))
|
||||||
|
|
||||||
|
SDEPS := $(patsubst %, %, $(SFILES:.S=.o.d))
|
||||||
|
CDEPS := $(patsubst %, %, $(CFILES:.c=.o.d))
|
||||||
|
CPPDEPS := $(patsubst %, %, $(CPPFILES:.cpp=.o.d))
|
||||||
|
DEPS := $(SDEPS) $(CDEPS) $(CPPDEPS)
|
||||||
|
|
||||||
|
SOBJS := $(patsubst %, %, $(SFILES:.S=.o))
|
||||||
|
COBJS := $(patsubst %, %, $(CFILES:.c=.o))
|
||||||
|
CPPOBJS := $(patsubst %, %, $(CPPFILES:.cpp=.o))
|
||||||
|
OBJS := $(SOBJS) $(COBJS) $(CPPOBJS)
|
||||||
|
|
||||||
|
OBJDIRS := $(patsubst %, %, $(SRCDIRS))
|
||||||
|
NAME := examples
|
||||||
|
VPATH := $(OBJDIRS)
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
all : $(NAME)
|
||||||
|
|
||||||
|
$(NAME) : $(OBJS)
|
||||||
|
@echo [LD] Linking $@
|
||||||
|
@$(CC) $(LDFLAGS) $(LIBDIRS) $^ -o $@ $(LIBS) -static
|
||||||
|
|
||||||
|
$(SOBJS) : %.o : %.S
|
||||||
|
@echo [AS] $<
|
||||||
|
@$(AS) $(ASFLAGS) -MD -MP -MF $@.d $(INCDIRS) -c $< -o $@
|
||||||
|
|
||||||
|
$(COBJS) : %.o : %.c
|
||||||
|
@echo [CC] $<
|
||||||
|
@$(CC) $(CFLAGS) -MD -MP -MF $@.d $(INCDIRS) -c $< -o $@
|
||||||
|
|
||||||
|
$(CPPOBJS) : %.o : %.cpp
|
||||||
|
@echo [CXX] $<
|
||||||
|
@$(CXX) $(CXXFLAGS) -MD -MP -MF $@.d $(INCDIRS) -c $< -o $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@$(RM) $(DEPS) $(OBJS) $(NAME) *.png
|
||||||
|
|
||||||
|
sinclude $(DEPS)
|
|
@ -0,0 +1,61 @@
|
||||||
|
#
|
||||||
|
# Makefile for library
|
||||||
|
#
|
||||||
|
|
||||||
|
CROSS_COMPILE ?=
|
||||||
|
|
||||||
|
AS := $(CROSS_COMPILE)gcc -x assembler-with-cpp
|
||||||
|
CC := $(CROSS_COMPILE)gcc
|
||||||
|
CXX := $(CROSS_COMPILE)g++
|
||||||
|
LD := $(CROSS_COMPILE)ld
|
||||||
|
AR := $(CROSS_COMPILE)ar
|
||||||
|
OC := $(CROSS_COMPILE)objcopy
|
||||||
|
OD := $(CROSS_COMPILE)objdump
|
||||||
|
RM := rm -fr
|
||||||
|
|
||||||
|
ASFLAGS := -g -ggdb -Wall -O3 -ffunction-sections -fdata-sections -ffreestanding -std=gnu99
|
||||||
|
CFLAGS := -g -ggdb -Wall -O3 -ffunction-sections -fdata-sections -ffreestanding -std=gnu99
|
||||||
|
CXXFLAGS := -g -ggdb -Wall -O3 -ffunction-sections -fdata-sections -ffreestanding -std=gnu99
|
||||||
|
INCDIRS := -I .
|
||||||
|
SRCDIRS := .
|
||||||
|
|
||||||
|
SFILES := $(foreach dir, $(SRCDIRS), $(wildcard $(dir)/*.S))
|
||||||
|
CFILES := $(foreach dir, $(SRCDIRS), $(wildcard $(dir)/*.c))
|
||||||
|
CPPFILES := $(foreach dir, $(SRCDIRS), $(wildcard $(dir)/*.cpp))
|
||||||
|
|
||||||
|
SDEPS := $(patsubst %, %, $(SFILES:.S=.o.d))
|
||||||
|
CDEPS := $(patsubst %, %, $(CFILES:.c=.o.d))
|
||||||
|
CPPDEPS := $(patsubst %, %, $(CPPFILES:.cpp=.o.d))
|
||||||
|
DEPS := $(SDEPS) $(CDEPS) $(CPPDEPS)
|
||||||
|
|
||||||
|
SOBJS := $(patsubst %, %, $(SFILES:.S=.o))
|
||||||
|
COBJS := $(patsubst %, %, $(CFILES:.c=.o))
|
||||||
|
CPPOBJS := $(patsubst %, %, $(CPPFILES:.cpp=.o))
|
||||||
|
OBJS := $(SOBJS) $(COBJS) $(CPPOBJS)
|
||||||
|
|
||||||
|
NAME := libcg.a
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
all : $(NAME)
|
||||||
|
|
||||||
|
$(NAME) : $(OBJS)
|
||||||
|
@echo [AR] Archiving $@
|
||||||
|
@$(AR) -rcs $@ $(OBJS)
|
||||||
|
|
||||||
|
$(SOBJS) : %.o : %.S
|
||||||
|
@echo [AS] $<
|
||||||
|
@$(AS) $(ASFLAGS) -MD -MP -MF $@.d $(INCDIRS) -c $< -o $@
|
||||||
|
|
||||||
|
$(COBJS) : %.o : %.c
|
||||||
|
@echo [CC] $<
|
||||||
|
@$(CC) $(CFLAGS) -MD -MP -MF $@.d $(INCDIRS) -c $< -o $@
|
||||||
|
|
||||||
|
$(CPPOBJS) : %.o : %.cpp
|
||||||
|
@echo [CXX] $<
|
||||||
|
@$(CXX) $(CXXFLAGS) -MD -MP -MF $@.d $(INCDIRS) -c $< -o $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@$(RM) $(DEPS) $(OBJS) $(NAME)
|
||||||
|
|
||||||
|
sinclude $(DEPS)
|
Loading…
Reference in New Issue