Skip to content

Commit

Permalink
some cleanups and reorganization
Browse files Browse the repository at this point in the history
use consistent makefiles across project
  • Loading branch information
anzz1 committed Jun 15, 2023
1 parent 7fbc22e commit b6b3509
Show file tree
Hide file tree
Showing 20 changed files with 368 additions and 109 deletions.
31 changes: 26 additions & 5 deletions src/batmon/makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
.PHONY: all
.PHONY: clean

TARGET=batmon

###########################################################

ifeq (,$(CROSS_COMPILE))
$(error missing CROSS_COMPILE for this toolchain)
endif

TARGET = batmon
###########################################################

ifeq ($(DEBUG), 1)
CFLAGS = -ggdb3 -Og -DDEBUG
else
CFLAGS = -Os -DNDEBUG
ifneq ($(PROFILE), 1)
CFLAGS += -fdata-sections -ffunction-sections -Wl,--gc-sections -s
endif
endif

CC = $(CROSS_COMPILE)gcc
CFLAGS = -marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -march=armv7ve
LDFLAGS = -lSDL -lSDL_image -lpthread
LIBS = -lSDL -lSDL_image -lpthread

CFLAGS += -Wall -marm -march=armv7ve+simd -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
CFLAGS += -flto -fipa-pta -fipa-ra -ftree-vectorize -ffast-math -funsafe-math-optimizations
CFLAGS += -fno-math-errno -fno-unwind-tables -fno-asynchronous-unwind-tables -std=gnu99
CFLAGS += $(LIBS)

all:
$(CC) $(TARGET).c -o $(TARGET) $(CFLAGS) $(LDFLAGS)
$(CC) $(TARGET).c -o $(TARGET) $(CFLAGS)

clean:
rm -f $(TARGET)
rm -f $(TARGET)
File renamed without changes.
29 changes: 24 additions & 5 deletions src/blank/makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
.PHONY: all
.PHONY: clean

TARGET=blank

###########################################################

ifeq (,$(CROSS_COMPILE))
$(error missing CROSS_COMPILE for this toolchain)
endif

TARGET = blank
###########################################################

ifeq ($(DEBUG), 1)
CFLAGS = -ggdb3 -Og -DDEBUG
else
CFLAGS = -Os -DNDEBUG
ifneq ($(PROFILE), 1)
CFLAGS += -fdata-sections -ffunction-sections -Wl,--gc-sections -s
endif
endif

CC = $(CROSS_COMPILE)gcc
CFLAGS = -marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -march=armv7ve
LDFLAGS =

CFLAGS += -Wall -marm -march=armv7ve+simd -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
CFLAGS += -flto -fipa-pta -fipa-ra -ftree-vectorize -ffast-math -funsafe-math-optimizations
CFLAGS += -fno-math-errno -fno-unwind-tables -fno-asynchronous-unwind-tables -std=gnu99

all:
$(CC) main.c -o $(TARGET) $(CFLAGS) $(LDFLAGS)
$(CC) $(TARGET).c -o $(TARGET) $(CFLAGS)

clean:
rm -f $(TARGET)
rm -f $(TARGET)
File renamed without changes.
31 changes: 26 additions & 5 deletions src/clock/makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
.PHONY: all
.PHONY: clean

TARGET=clock

###########################################################

ifeq (,$(CROSS_COMPILE))
$(error missing CROSS_COMPILE for this toolchain)
endif

TARGET = clock
###########################################################

ifeq ($(DEBUG), 1)
CFLAGS = -ggdb3 -Og -DDEBUG
else
CFLAGS = -Os -DNDEBUG
ifneq ($(PROFILE), 1)
CFLAGS += -fdata-sections -ffunction-sections -Wl,--gc-sections -s
endif
endif

CC = $(CROSS_COMPILE)gcc
CFLAGS = -marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -march=armv7ve
LDFLAGS = -lSDL -lSDL_image
LIBS = -lSDL -lSDL_image

CFLAGS += -Wall -marm -march=armv7ve+simd -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
CFLAGS += -flto -fipa-pta -fipa-ra -ftree-vectorize -ffast-math -funsafe-math-optimizations
CFLAGS += -fno-math-errno -fno-unwind-tables -fno-asynchronous-unwind-tables -std=gnu99
CFLAGS += $(LIBS)

all:
$(CC) main.c -o $(TARGET) $(CFLAGS) $(LDFLAGS)
$(CC) $(TARGET).c -o $(TARGET) $(CFLAGS)

clean:
rm -f $(TARGET)
rm -f $(TARGET)
1 change: 1 addition & 0 deletions src/common/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ int GFX_blitHint(SDL_Surface* surface, char* htxt, int x, int y) {
SDL_Surface* hint_text = TTF_RenderUTF8_Blended(font_m, htxt, white);
SDL_BlitSurface(hint_text, NULL, surface, &(SDL_Rect){x,y});
SDL_FreeSurface(hint_text);
return hint_text->w;
}
int GFX_blitPill(SDL_Surface* surface, char* btxt, char* htxt, int x, int y) {
SDL_Surface* button_text = TTF_RenderUTF8_Blended(font_s, btxt, bronze);
Expand Down
File renamed without changes.
29 changes: 24 additions & 5 deletions src/confirm/makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
.PHONY: all
.PHONY: clean

TARGET=confirm

###########################################################

ifeq (,$(CROSS_COMPILE))
$(error missing CROSS_COMPILE for this toolchain)
endif

TARGET = confirm
###########################################################

ifeq ($(DEBUG), 1)
CFLAGS = -ggdb3 -Og -DDEBUG
else
CFLAGS = -Os -DNDEBUG
ifneq ($(PROFILE), 1)
CFLAGS += -fdata-sections -ffunction-sections -Wl,--gc-sections -s
endif
endif

CC = $(CROSS_COMPILE)gcc
CFLAGS = -marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -march=armv7ve
LDFLAGS =

CFLAGS += -Wall -marm -march=armv7ve+simd -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
CFLAGS += -flto -fipa-pta -fipa-ra -ftree-vectorize -ffast-math -funsafe-math-optimizations
CFLAGS += -fno-math-errno -fno-unwind-tables -fno-asynchronous-unwind-tables -std=gnu99

all:
$(CC) main.c -o $(TARGET) $(CFLAGS) $(LDFLAGS)
$(CC) $(TARGET).c -o $(TARGET) $(CFLAGS)

clean:
rm -f $(TARGET)
rm -f $(TARGET)
31 changes: 25 additions & 6 deletions src/keyboard/makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
.PHONY: all
.PHONY: clean

TARGET=keyboard

###########################################################

ifeq (,$(CROSS_COMPILE))
$(error missing CROSS_COMPILE for this toolchain)
endif

TARGET = keyboard
###########################################################

ifeq ($(DEBUG), 1)
CFLAGS = -ggdb3 -Og -DDEBUG
else
CFLAGS = -Os -DNDEBUG
ifneq ($(PROFILE), 1)
CFLAGS += -fdata-sections -ffunction-sections -Wl,--gc-sections -s
endif
endif

CC = $(CROSS_COMPILE)gcc
CFLAGS = -Os -marm -march=armv7ve+simd -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
CFLAGS += -Wall -ffunction-sections -fdata-sections -fmerge-all-constants -fno-stack-protector -fno-ident -fomit-frame-pointer
CFLAGS += -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops -fno-math-errno -ffast-math
LDFLAGS = -lSDL -lSDL_image -lSDL_ttf -Wl,--gc-sections -s
LIBS = -lSDL -lSDL_image -lSDL_ttf

CFLAGS += -Wall -marm -march=armv7ve+simd -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
CFLAGS += -flto -fipa-pta -fipa-ra -ftree-vectorize -ffast-math -funsafe-math-optimizations
CFLAGS += -fno-math-errno -fno-unwind-tables -fno-asynchronous-unwind-tables -std=gnu99
CFLAGS += $(LIBS)

all:
$(CC) keyboard.c -o $(TARGET) $(CFLAGS) $(LDFLAGS)
$(CC) $(TARGET).c -o $(TARGET) $(CFLAGS)

clean:
rm -f $(TARGET)
30 changes: 27 additions & 3 deletions src/keymon/makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
.PHONY: all
.PHONY: clean

TARGET=keymon

###########################################################

ifeq (,$(CROSS_COMPILE))
$(error missing CROSS_COMPILE for this toolchain)
endif

###########################################################

ifeq ($(DEBUG), 1)
CFLAGS = -ggdb3 -Og -DDEBUG
else
CFLAGS = -Os -DNDEBUG
ifneq ($(PROFILE), 1)
CFLAGS += -fdata-sections -ffunction-sections -Wl,--gc-sections -s
endif
endif

CC = $(CROSS_COMPILE)gcc
FLAGS = -Os -lmsettings -lpthread -lrt -ldl -Wl,--gc-sections -s
LIBS = -lmsettings -lpthread -lrt -ldl

CFLAGS += -Wall -marm -march=armv7ve+simd -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
CFLAGS += -flto -fipa-pta -fipa-ra -ftree-vectorize -ffast-math -funsafe-math-optimizations
CFLAGS += -fno-math-errno -fno-unwind-tables -fno-asynchronous-unwind-tables -std=gnu99
CFLAGS += $(LIBS)

all:
$(CC) keymon.c -o keymon $(FLAGS)
$(CC) $(TARGET).c -o $(TARGET) $(CFLAGS)

clean:
rm -rf keymon
rm -f $(TARGET)
49 changes: 26 additions & 23 deletions src/libmmenu/makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: build
.PHONY: all
.PHONY: clean

TARGET=mmenu
Expand All @@ -20,32 +20,35 @@ endif

###########################################################

CC = $(CROSS_COMPILE)gcc

SYSROOT := $(shell $(CC) --print-sysroot)

INCLUDEDIR = $(SYSROOT)/usr/include
CFLAGS = -I$(INCLUDEDIR) -I. -I../common -DPLATFORM_$(shell echo $(PLATFORM) | tr a-z A-Z) -std=gnu99
LDFLAGS = -s -lSDL -lSDL_image -lSDL_ttf -lz -lm -Wl,--no-as-needed -ldl -lrt

CFLAGS += -ggdb3 -Og

ifeq (trimui,$(PLATFORM))
LDFLAGS += -ltinyalsa
ifeq ($(DEBUG), 1)
CFLAGS = -ggdb3 -Og -DDEBUG
else
CFLAGS = -Os -DNDEBUG
ifneq ($(PROFILE), 1)
CFLAGS += -fdata-sections -ffunction-sections -Wl,--gc-sections -s
endif
endif
ifeq (rs90,$(PLATFORM))
LDFLAGS += -lasound
endif

OPTM=-Ofast

build:
$(CC) -c -Werror -fpic $(TARGET).c ../common/common.c $(CFLAGS) $(LDFLAGS) $(OPTM)
$(CC) -shared -o lib$(TARGET).so $(TARGET).o common.o
CC = $(CROSS_COMPILE)gcc
SYSROOT := $(shell $(CC) --print-sysroot)
INCLUDEDIR = $(SYSROOT)/usr/include
LIBS = -lSDL -lSDL_image -lSDL_ttf -lz -lm -ldl -lrt

CFLAGS += -Wall -marm -march=armv7ve+simd -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
CFLAGS += -flto -fipa-pta -fipa-ra -ftree-vectorize -ffast-math -funsafe-math-optimizations
CFLAGS += -fno-math-errno -fno-unwind-tables -fno-asynchronous-unwind-tables
CFLAGS += -I$(INCLUDEDIR) -I. -I../common -DPLATFORM_$(shell echo $(PLATFORM) | tr a-z A-Z) -std=gnu99
CFLAGS += -Wl,--no-as-needed
LDFLAGS = $(CFLAGS) $(LIBS)

all:
$(CC) -c -fpic $(TARGET).c ../common/common.c $(CFLAGS)
$(CC) -shared -o lib$(TARGET).so $(TARGET).o common.o $(LDFLAGS)
cp $(TARGET).h $(PREFIX)/include
cp lib$(TARGET).so $(PREFIX)/lib

clean:
rm -f *.o
rm -f $(TARGET).o common.o
rm -f lib$(TARGET).so
rm -f $(PREFIX)/include/$(TARGET).h
rm -f $(PREFIX)/lib/lib$(TARGET).so
rm -f $(PREFIX)/lib/lib$(TARGET).so
58 changes: 40 additions & 18 deletions src/libmsettings/makefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,54 @@
.PHONY: all
.PHONY: clean

TARGET=msettings

###########################################################

ifeq (,$(PLATFORM))
PLATFORM=$(UNION_PLATFORM)
endif
ifeq (,$(PLATFORM))
$(error please specify PLATFORM, eg. make PLATFORM=trimui)
endif
ifeq (,$(CROSS_COMPILE))
$(error missing CROSS_COMPILE for this toolchain)
endif
ifeq (,$(PREFIX))
$(error missing PREFIX for this toolchain)
$(error missing PREFIX for installation in toolchain)
endif

TARGET=msettings
###########################################################

.PHONY: build
.PHONY: clean
ifeq ($(DEBUG), 1)
CFLAGS = -ggdb3 -Og -DDEBUG
else
CFLAGS = -Os -DNDEBUG
ifneq ($(PROFILE), 1)
CFLAGS += -fdata-sections -ffunction-sections -Wl,--gc-sections -s
endif
endif

CC = $(CROSS_COMPILE)gcc

SYSROOT := $(shell $(CC) --print-sysroot)

SYSROOT := $(shell $(CC) --print-sysroot)
INCLUDEDIR = $(SYSROOT)/usr/include
CFLAGS = -I$(INCLUDEDIR)
LDFLAGS = -lcam_os_wrapper -lmi_sys -lmi_ao -ldl -lrt -s -lm
LIBS = -lcam_os_wrapper -lmi_sys -lmi_ao -lm -ldl -lrt

CFLAGS += -Wall -marm -march=armv7ve+simd -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
CFLAGS += -flto -fipa-pta -fipa-ra -ftree-vectorize -ffast-math -funsafe-math-optimizations
CFLAGS += -fno-math-errno -fno-unwind-tables -fno-asynchronous-unwind-tables
CFLAGS += -I$(INCLUDEDIR) -DPLATFORM_$(shell echo $(PLATFORM) | tr a-z A-Z) -std=gnu99
CFLAGS += -Wl,--no-as-needed
LDFLAGS = $(CFLAGS) $(LIBS)

OPTM=-Ofast
all:
$(CC) -c -fpic $(TARGET).c $(CFLAGS)
$(CC) -shared -o lib$(TARGET).so $(TARGET).o $(LDFLAGS)
cp $(TARGET).h $(PREFIX)/include
cp lib$(TARGET).so $(PREFIX)/lib

build:
$(CC) -c -Werror -fpic "$(TARGET).c" -Wl,--no-as-needed $(LDFLAGS)
$(CC) -shared -o "lib$(TARGET).so" "$(TARGET).o" $(LDFLAGS)
cp "$(TARGET).h" "$(PREFIX)/include"
cp "lib$(TARGET).so" "$(PREFIX)/lib"
clean:
rm -f *.o
rm -f "lib$(TARGET).so"
rm -f $(TARGET).o
rm -f lib$(TARGET).so
rm -f $(PREFIX)/include/$(TARGET).h
rm -f $(PREFIX)/lib/lib$(TARGET).so
rm -f $(PREFIX)/lib/lib$(TARGET).so
Loading

0 comments on commit b6b3509

Please sign in to comment.