michael@1: # This Makefile builds all the third_party code michael@1: # It shouldn't be called by anything other than automated scripts michael@1: michael@1: # Both lzo and openvpn should be built universally michael@1: michael@1: LZO_DIR=lzo-2.02 michael@1: PKCS11_DIR=pkcs11-helper-1.07 michael@1: michael@1: all: tuntap lzo openvpn michael@1: michael@1: pkcs11-helper:: michael@1: @for a in ppc i686; do \ michael@1: echo Configure PKCS11-Helper for $$a; \ michael@1: cd $(PKCS11_DIR); \ michael@1: echo Forcefully be clean; \ michael@1: $(MAKE) clean; \ michael@1: OPENSSL_LIBS="-lcrypto" CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -Os -mmacosx-version-min=10.4 -arch $$a" ./configure --enable-static --disable-dependency-tracking --prefix=$$(pwd)/staging_$$a/ --includedir=$$(pwd)/staging/include/; \ michael@1: echo Build PKCS11-Helper; \ michael@1: $(MAKE); \ michael@1: echo Install to third_party/$(PKCS11_DIR)/staging_$$a; \ michael@1: $(MAKE) install; \ michael@1: cd ../; \ michael@1: done michael@1: mkdir -p $(PKCS11_DIR)/staging/lib michael@1: lipo $(PKCS11_DIR)/staging_*/lib/libpkcs11-helper.a -create -output $(PKCS11_DIR)/staging/lib/libpkcs11-helper.a michael@1: cp $(PKCS11_DIR)/staging_i686/lib/libpkcs11-helper.la $(PKCS11_DIR)/staging/lib/ michael@1: michael@1: lzo:: michael@1: @for a in ppc i686; do \ michael@1: echo Configure LZO for $$a; \ michael@1: cd $(LZO_DIR); \ michael@1: echo Forcefully be clean; \ michael@1: $(MAKE) clean; \ michael@1: CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -Os -mmacosx-version-min=10.4 -arch $$a" ./configure --disable-dependency-tracking --disable-asm --prefix=$$(pwd)/staging_$$a/ --includedir=$$(pwd)/staging/include/; \ michael@1: echo Build LZO; \ michael@1: $(MAKE); \ michael@1: echo Install to third_party/$(LZO_DIR)/staging_$$a; \ michael@1: $(MAKE) install; \ michael@1: cd ../; \ michael@1: done michael@1: michael@1: # Use lipo to create a universal library michael@1: mkdir -p $(LZO_DIR)/staging/lib michael@1: lipo $(LZO_DIR)/staging_*/lib/liblzo2.a -create -output $(LZO_DIR)/staging/lib/liblzo2.a michael@1: cp $(LZO_DIR)/staging_i686/lib/liblzo2.la $(LZO_DIR)/staging/lib/ michael@1: michael@1: # wtf? library was renamed??? move it back so openvpn will build correctly michael@1: cd $(LZO_DIR)/staging/lib/; mv liblzo2.a liblzo.a; mv liblzo2.la liblzo.la michael@1: michael@1: lzo-clean: michael@1: $(MAKE) -C $(LZO_DIR) clean michael@1: rm -rf $(LZO_DIR)/staging* michael@1: michael@1: openvpn: lzo pkcs11-helper michael@1: @for a in ppc i686; do \ michael@1: echo Configure OpenVPN for $$a; \ michael@1: cd openvpn/; \ michael@1: echo Forcefully be clean; \ michael@1: $(MAKE) clean; \ michael@1: autoreconf -i -v; \ michael@1: LDFLAGS="-L../$(PKCS11_DIR)/staging/lib/" CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -Os -mmacosx-version-min=10.4 -arch $$a" ./configure --with-lzo-headers=../$(LZO_DIR)/staging/include/ --with-lzo-lib=../$(LZO_DIR)/staging/lib/ --with-pkcs11-helper-headers=../$(PKCS11_DIR)/staging/include/ --with-pkcs11-helper-libs=../$(PKCS11_DIR)/staging/lib/ --disable-dependency-tracking; \ michael@1: echo Build OpenVPN; \ michael@1: $(MAKE); \ michael@1: mv openvpn openvpn_tblk_$$a; \ michael@1: cd ../; \ michael@1: done michael@1: michael@1: # Use lipo to create a universal library michael@1: lipo openvpn/openvpn_tblk_* -create -output openvpn/openvpn michael@1: michael@1: openvpn-clean: michael@1: $(MAKE) -C openvpn/ clean michael@1: rm -f openvpn/openvpn_tblk_* michael@1: michael@1: .PHONY : tuntap michael@1: michael@1: tuntap: michael@1: # Now we'll build the tun/tap driver michael@1: $(MAKE) -C tuntap/ michael@1: michael@1: tuntap-clean: michael@1: $(MAKE) -C tuntap/ clean michael@1: michael@1: michael@1: michael@1: clean: lzo-clean tuntap-clean openvpn-clean