Skip to content

Instantly share code, notes, and snippets.

@nega0
Last active December 28, 2015 19:49
Show Gist options
  • Save nega0/7553410 to your computer and use it in GitHub Desktop.
Save nega0/7553410 to your computer and use it in GitHub Desktop.
--- /dev/null 2015-09-14 09:02:32.937677367 -0400
+++ Makefile 2015-09-18 12:14:24.000000000 -0400
@@ -0,0 +1,36 @@
+CC=gcc
+CFLAGS=$(FFLAGS)
+OSNAME=$(shell uname -s)
+
+all: lib-shared
+
+tpythia6_called_from_cc.o:
+ $(FC) $(FFLAGS) -fno-second-underscore -c tpythia6_called_from_cc.F
+
+ifeq ($(OSNAME), Darwin)
+lib-shared: libPythia6.dylib libPythia6.so
+
+libPythia6.dylib: main.o tpythia6_called_from_cc.o pythia6_common_address.o pythia6_rng_callback.o pythia6416.o
+ $(FC) -m64 -dynamiclib -single_module -undefined dynamic_lookup \
+ -install_name $(PREFIX)/lib/$@ -o $@ $+
+
+libPythia6.so: libPythia6.dylib
+ @ln -s $< $@
+
+install: libPythia6.dylib libPythia6.so
+endif
+
+ifeq ($(OSNAME), Linux)
+lib-shared: libPythia6.so
+
+libPythia6.so: main.o pythia6_common_address.o pythia6416.o tpythia6_called_from_cc.o pythia6_rng_callback.o
+ $(FC) -shared -Wl,-soname,libPythia6.so -o libPythia6.so $+
+
+install: libPythia6.so
+endif
+ install -m 755 -d $(DESTDIR)$(PREFIX)/lib
+ install -m 644 $+ $(DESTDIR)$(PREFIX)/lib
+
+.PHONY: clean
+clean:
+ $(RM) *.o libPythia6.* a.out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment