aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2005-12-19 20:40:31 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2005-12-19 20:40:31 +0000
commitec4303a38f6e509646df8365326a4a293bdc7b33 (patch)
tree2e1ba7228fbf0a77cc4f921b571a8ff066eb124a /Makefile
parent66ad495619142d1ac7051708dad92dc0aa2ba97e (diff)
got the basic sketch working, but now I have to figure out the hid.dll nameclash issue... arg
svn path=/trunk/externals/hcs/hid/; revision=4258
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile142
1 files changed, 111 insertions, 31 deletions
diff --git a/Makefile b/Makefile
index be7e008..1013a3e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,35 +1,76 @@
+TARGET=hid
-OS_NAME = $(shell uname -s)
+default:
+ make -C ../../ $(TARGET)
+install:
+ make -C ../../ $(TARGET)_install
-# ----------------------- GNU/LINUX i386 -----------------------
-ifeq ($(OS_NAME),Linux)
-LDFLAGS = -export_dynamic -shared
-.SUFFIXES: .pd_linux
+clean:
+ make -C ../../ $(TARGET)_clean
+
+
+
+# this stuff below probably works, but its not maintained anymore since I use
+# externals/Makefile
+
+CWD := $(shell pwd)
+
+# these are setup to be overridden by the packages/Makefile
+cvs_root_dir = $(CWD)/../../..
+DESTDIR = $(CWD)/build/
+BUILDLAYOUT_DIR = $(cvs_root_dir)/packages
+
+include $(BUILDLAYOUT_DIR)/Makefile.buildlayout
+
+CFLAGS = $(OPT_FLAGS) -Wall -I./ -I../../../pd/src
+LDFLAGS =
+LIBS = -lm
-all: input_arrays pd_linux
-pd_linux: hid.pd_linux
+#SRC = $(wildcard $(externals_src)/hcs/hid/hid*.c)
+SRC = $(wildcard *.c)
+SRC = input_arrays.c hid_$(OS_NAME).c
+OBJ := $(SRC:.c=.o)
+
+# ----------------------- GNU/LINUX i386 -----------------------
+ifeq ($(OS_NAME),linux)
+ EXTENSION = pd_linux
+ LDFLAGS += -export_dynamic -shared
+ LIBS += -lc
+ STRIP = strip --strip-unneeded
+ hid.$(EXTENSION): input_arrays $(OBJ)
+endif
+
+# ----------------------- Windows MinGW -----------------------
+ifeq ($(OS_NAME),win)
+ EXTENSION = dll
+ CFLAGS += -mms-bitfields
+ LDFLAGS += -shared
+ LIBS += -lhid -lsetupapi -L../../../pd/bin -lpd
+ STRIP = strip --strip-unneeded
+ hid.$(EXTENSION): input_arrays $(OBJ)
endif
# ----------------------- DARWIN -----------------------
-ifeq ($(OS_NAME),Darwin)
-FRAMEWORKS = Carbon IOKit ForceFeedback
-LDFLAGS = -bundle -bundle_loader $(PDEXECUTABLE) \
- -L/sw/lib -L./HID\ Utilities\ Source/build \
- -lHIDUtilities \
- $(patsubst %,-framework %,$(FRAMEWORKS))
-.SUFFIXES: .pd_darwin
+ifeq ($(OS_NAME),darwin)
+ EXTENSION = pd_darwin
+ CFLAGS += -I./HID\ Utilities\ Source
+ PDEXECUTABLE = ../../../pd/bin/pd
+ FRAMEWORKS = Carbon IOKit ForceFeedback
+ LDFLAGS += -bundle -bundle_loader $(PDEXECUTABLE)
+ LIBS += -lc -L/sw/lib -L./HID\ Utilities\ Source/build \
+ -lHIDUtilities $(patsubst %,-framework %,$(FRAMEWORKS))
+ STRIP = strip -x
+ hid.$(EXTENSION): input_arrays hid_utilites $(OBJ)
+endif
-all: input_arrays hid_utilities pd_darwin
-pd_darwin: hid.pd_darwin
+all: hid.$(EXTENSION)
-endif
+.SUFFIXES: .$(EXTENSION)
# ----------------------- GENERAL ---------------------------------------------
-PDEXECUTABLE = ../../../pd/bin/pd
-
# generic optimization
OPT_FLAGS = -O3 -ffast-math
# G4 optimization on Mac OS X
@@ -41,26 +82,65 @@ OPT_FLAGS = -O3 -ffast-math
# faster G4 7450 optimization (gives errors) on Mac OS X
#OPT_FLAGS = -ffast -mcpu=7450 -faltivec -ffast-math -fPIC
-CFLAGS = $(OPT_FLAGS) -Wall -W -Wno-shadow -Wstrict-prototypes -Wno-unused
+%.o: %.c
+ $(CC) $(CFLAGS) -o "$*.o" -c "$*.c"
+
+%.$(EXTENSION): %.o
+ $(CC) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(OBJ) $(LIBS) \
+ `test -f $*.libs && cat $*.libs` \
+ `test -f $(dir $*)../$(OS_NAME)/$(notdir $*).libs && \
+ cat $(dir $*)../$(OS_NAME)/$(notdir $*).libs`
+ chmod a-x "$*.$(EXTENSION)"
+ $(STRIP) $*.$(EXTENSION)
+ rm -f -- $*.o
-INCLUDE = -I./ -I../../../pd/src -I./HID\ Utilities\ Source
-.c.o:
- $(CC) $(CFLAGS) $(INCLUDE) -c *.c
+input_arrays: input_arrays.c input_arrays.h
-.o.pd_darwin:
- $(CC) $(LDFLAGS) -o $*.pd_darwin *.o
+input_arrays.c: linux/input.h
+ ./make-arrays-from-input.h.pl
-.o.pd_linux:
- ld $(LDFLAGS) -o $*.pd_linux *.o -lc -lm
- strip --strip-unneeded $*.pd_linux
+input_arrays.h: linux/input.h
+ ./make-arrays-from-input.h.pl
-input_arrays:
- test -f input_arrays.h || ./make-arrays-from-input.h.pl
hid_utilities:
test -f ./HID\ Utilities\ Source/build/libHIDUtilities.a || \
( cd ./HID\ Utilities\ Source && pbxbuild )
-clean: ; rm -f *.pd_* *.o *~ input_arrays.? doc/ev*-list.pd
+local_clean:
+ -rm -f -- *.$(EXTENSION) *~
+ -find . -name '*.o' | xargs rm -f --
+
+distclean: local_clean
+ -rm -f -- input_arrays.? doc/ev*-list.pd
+
+.PHONY: all input_arrays hid_utilities clean distclean
+
+
+test_locations:
+ @echo "EXTENSION: $(EXTENSION)"
+ @echo "CFLAGS: $(CFLAGS)"
+ @echo "LDFLAGS: $(LDFLAGS)"
+ @echo "LIBS: $(LIBS)"
+ @echo "STRIP: $(STRIP)"
+ @echo " "
+ @echo "SRC: $(SRC)"
+ @echo "OBJ: $(OBJ)"
+ @echo " "
+ @echo "OS_NAME: $(OS_NAME)"
+ @echo "PD_VERSION: $(PD_VERSION)"
+ @echo "PACKAGE_VERSION: $(PACKAGE_VERSION)"
+ @echo "CWD $(CWD)"
+ @echo "DESTDIR $(DESTDIR)"
+ @echo "PREFIX $(prefix)"
+ @echo "BINDIR $(bindir)"
+ @echo "LIBDIR $(libdir)"
+ @echo "OBJECTSDIR $(objectsdir)"
+ @echo "PDDOCDIR $(pddocdir)"
+ @echo "LIBPDDIR $(libpddir)"
+ @echo "LIBPDBINDIR $(libpdbindir)"
+ @echo "HELPDIR $(helpdir)"
+ @echo "MANUALSDIR $(manualsdir)"
+ @echo "EXAMPLESDIR $(examplesdir)"