Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to original makefile. #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
ifeq ($(platform),PS2)
#Set PS2SDK stuff
CC = $(EE_CC)
PREFIX ?= $(PS2SDK)/ports
EE_INCS +=
EE_CFLAGS +=
EE_LDFLAGS +=
EE_ASFLAGS +=
EE_OBJS = tap.o
EE_LIB = libtap.a
LDLIBS += $(EE_LIBS)
CFLAGS= $(EE_CFLAGS) -I.
include $(PS2SDK)/samples/Makefile.pref
include $(PS2SDK)/samples/Makefile.eeglobal
else
CC ?= gcc
CFLAGS += -Wall -I. -fPIC
PREFIX ?= $(DESTDIR)/usr/local
endif
TESTS = $(patsubst %.c, %, $(wildcard t/*.c))

ifdef ANSI
Expand All @@ -21,7 +37,11 @@ endif
%.so:
$(CC) -shared $(LDFLAGS) $(TARGET_ARCH) $(filter %.o, $^) $(LDLIBS) -o $@

ifeq ($(platform), PS2)
all: libtap.a tap.pc tests
else
all: libtap.a libtap.so tap.pc tests
endif

tap.pc:
@echo generating tap.pc
Expand All @@ -39,16 +59,38 @@ tap.pc:

libtap.a: tap.o

ifeq ($(platform), PS2)
tap.o: tap.h
else
libtap.so: tap.o

tap.o: tap.c tap.h
endif

tests: $(TESTS)

$(TESTS): %: %.o libtap.a
ifeq ($(platform), PS2)
$(TESTS): %: %.o $(EE_OBJS)
$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -o $@ $(EE_OBJS) $< $(EE_LDFLAGS) $(EE_LIBS)

else
$(TESTS): %: %.o libtap.a
$(patsubst %, %.o, $(TESTS)): %.o: %.c tap.h
endif

ifeq ($(platform), PS2)
clean:
rm -rf *.o t/*.o tap.pc libtap.a $(TESTS)

install: libtap.a tap.h tap.pc
mkdir -p $(PREFIX)/lib $(PREFIX)/include $(PREFIX)/lib/pkgconfig
install -c libtap.a $(PREFIX)/lib
install -c tap.pc $(PREFIX)/lib/pkgconfig
install -c tap.h $(PREFIX)/include


uninstall:
rm $(PREFIX)/lib/libtap.a $(PREFIX)/include/tap.h
else
clean:
rm -rf *.o t/*.o tap.pc libtap.a libtap.so $(TESTS)

Expand All @@ -59,8 +101,10 @@ install: libtap.a tap.h libtap.so tap.pc
install -c tap.pc $(PREFIX)/lib/pkgconfig
install -c tap.h $(PREFIX)/include


uninstall:
rm $(PREFIX)/lib/libtap.a $(PREFIX)/lib/libtap.so $(PREFIX)/include/tap.h
endif

dist:
rm libtap.zip
Expand Down
32 changes: 0 additions & 32 deletions Makefile.PS2

This file was deleted.

4 changes: 2 additions & 2 deletions README.PS2.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Installation

To build and install libtap, simply run:

$ make -f Makefile.PS2 all
# make -f Makefile.PS2 install
$ make platform=PS2 all
# make platform=PS2 install

To run the included tests on your PS2, e.g. `t/simple`, use ps2client:

Expand Down