Skip to content

Commit

Permalink
Use static linking instead of dynamic linking
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewFromMelbourne committed Apr 13, 2020
1 parent c280615 commit e2ee6fa
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion game/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ OBJS=main.o
BIN=game

CFLAGS+=-Wall -g -O3 -I../common $(shell libpng-config --cflags)
LDFLAGS+=-L/opt/vc/lib/ -lbcm_host -lm $(shell libpng-config --ldflags) -L../lib -lraspidmx
LDFLAGS+=-L/opt/vc/lib/ -lbcm_host -lm $(shell libpng-config --ldflags) -L../lib -lraspidmx -lraspidmxPng

INCLUDES+=-I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux

Expand Down
22 changes: 12 additions & 10 deletions lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,33 @@
#

LIB=raspidmx
LIBPNG=raspidmxPng

OBJS=../common/backgroundLayer.o ../common/imageGraphics.o ../common/key.o ../common/spriteLayer.o \
../common/font.o ../common/imageKey.o ../common/loadpng.o \
../common/hsv2rgb.o ../common/imageLayer.o ../common/savepng.o \
../common/image.o ../common/imagePalette.o ../common/scrollingLayer.o
OBJS=../common/backgroundLayer.o ../common/imageGraphics.o ../common/key.o \
../common/font.o ../common/imageKey.o ../common/hsv2rgb.o \
../common/imageLayer.o ../common/image.o ../common/imagePalette.o

OBJSPNG=../common/spriteLayer.o ../common/loadpng.o ../common/savepng.o ../common/scrollingLayer.o

CFLAGS+=-Wall -g -O3 -I../common $(shell libpng-config --cflags)
LDFLAGS+=-L/opt/vc/lib/ -lbcm_host -lm $(shell libpng-config --ldflags)
LDFLAGS+=-L/opt/vc/lib/ -lbcm_host -lm
LDFLAGSPNG=${LDFLAGS} $(shell libpng-config --ldflags)

INCLUDES+=-I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux

all: $(LIB)
all: $(LIB) $(LIBPNG)

%.o: %.c
@rm -f $@
$(CC) $(CFLAGS) $(INCLUDES) -g -c $< -o $@ -Wno-deprecated-declarations

$(LIB): $(OBJS)
$(AR) rcs lib$(LIB).a $(OBJS)
$(CC) -shared -Wl,-soname,lib$(LIB).so.1 $(LDFLAGS) -o lib$(LIB).so.1 $(OBJS)

# TODO: move to debian package
ln -sfv lib$(LIB).so.1 lib$(LIB).so
$(LIBPNG): $(OBJSPNG)
$(AR) rcs lib$(LIBPNG).a $(OBJSPNG)


clean:
@rm -f $(OBJS)
@rm -f lib$(LIB).so*
@rm -f lib$(LIB).a
2 changes: 1 addition & 1 deletion mandelbrot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ OBJS=main.o mandelbrot.o info.o
BIN=mandelbrot

CFLAGS+=-Wall -g -O3 -I../common $(shell libpng-config --cflags)
LDFLAGS+=-L/opt/vc/lib/ -lbcm_host -lm $(shell libpng-config --ldflags) -L../lib -lraspidmx
LDFLAGS+=-L/opt/vc/lib/ -lbcm_host -lm $(shell libpng-config --ldflags) -L../lib -lraspidmx -lraspidmxPng

INCLUDES+=-I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux

Expand Down
2 changes: 1 addition & 1 deletion offscreen/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ OBJS=pngresize.o resizeDispmanX.o
BIN=pngresize

CFLAGS+=-Wall -g -O3 -I../common $(shell libpng-config --cflags)
LDFLAGS+=-L/opt/vc/lib/ -lbcm_host -lm $(shell libpng-config --ldflags) -L../lib -lraspidmx
LDFLAGS+=-L/opt/vc/lib/ -lbcm_host -lm $(shell libpng-config --ldflags) -L../lib -lraspidmx -lraspidmxPng

INCLUDES+=-I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux

Expand Down
2 changes: 1 addition & 1 deletion pngview/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ OBJS=pngview.o
BIN=pngview

CFLAGS+=-Wall -g -O3 -I../common $(shell libpng-config --cflags)
LDFLAGS+=-L/opt/vc/lib/ -lbcm_host -lm $(shell libpng-config --ldflags) -L../lib -lraspidmx
LDFLAGS+=-L/opt/vc/lib/ -lbcm_host -lm $(shell libpng-config --ldflags) -L../lib -lraspidmx -lraspidmxPng

INCLUDES+=-I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux

Expand Down
2 changes: 1 addition & 1 deletion spriteview/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ OBJS=spriteview.o
BIN=spriteview

CFLAGS+=-Wall -g -O3 -I../common $(shell libpng-config --cflags)
LDFLAGS+=-L/opt/vc/lib/ -lbcm_host -lm $(shell libpng-config --ldflags) -L../lib -lraspidmx
LDFLAGS+=-L/opt/vc/lib/ -lbcm_host -lm $(shell libpng-config --ldflags) -L../lib -lraspidmx -lraspidmxPng

INCLUDES+=-I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux

Expand Down

0 comments on commit e2ee6fa

Please sign in to comment.