Browse Source

generate epgsql.app at compile time

Will 14 years ago
parent
commit
0cbf00e9cb
5 changed files with 8 additions and 5 deletions
  1. 1 0
      .gitignore
  2. 6 3
      Makefile
  3. 0 0
      ebin/.empty
  4. 0 1
      ebin/epgsql.app
  5. 1 1
      src/epgsql.app.src

+ 1 - 0
.gitignore

@@ -1,3 +1,4 @@
 *.beam
 *.boot
 *.script
+ebin/*.app

+ 6 - 3
Makefile

@@ -15,7 +15,7 @@ RELEASE		:= $(NAME)-$(VERSION).tar.gz
 APPDIR		:= $(NAME)-$(VERSION)
 BEAMS		:= $(SRC:src/%.erl=ebin/%.beam) 
 
-compile: $(BEAMS)
+compile: $(BEAMS) ebin/$(NAME).app
 
 app: compile
 	@mkdir -p $(APPDIR)/ebin
@@ -26,11 +26,11 @@ release: app
 	@tar czvf $(RELEASE) $(APPDIR)
 
 clean:
-	@rm -f ebin/*.beam
+	@rm -f ebin/*.{beam,app}
 	@rm -rf $(NAME)-$(VERSION) $(NAME)-*.tar.gz
 
 test: $(TESTS:test_src/%.erl=test_ebin/%.beam) $(BEAMS)
-	@dialyzer --src -c src
+	@dialyzer -n --src -c src
 	$(ERL) -pa ebin/ -pa test_ebin/ -noshell -s pgsql_tests run_tests -s init stop
 
 # ------------------------------------------------------------------------
@@ -41,5 +41,8 @@ test: $(TESTS:test_src/%.erl=test_ebin/%.beam) $(BEAMS)
 ebin/%.beam : src/%.erl
 	$(ERLC) $(ERLC_FLAGS) -o $(dir $@) $<
 
+ebin/%.app : src/%.app.src
+	sed -e s/VERSION/$(VERSION)/g $< > $@
+
 test_ebin/%.beam : test_src/%.erl
 	$(ERLC) $(ERLC_FLAGS) -o $(dir $@) $<

+ 0 - 0
ebin/.empty


+ 0 - 1
ebin/epgsql.app

@@ -1 +0,0 @@
-../src/epgsql.app

+ 1 - 1
src/epgsql.app → src/epgsql.app.src

@@ -1,6 +1,6 @@
 {application, epgsql,
  [{description, "PostgreSQL Client"},
-  {vsn, "1.2"},
+  {vsn, "VERSION"},
   {modules, [pgsql, pgsql_binary, pgsql_connection, pgsql_fdatetime,
              pgsql_idatetime, pgsql_sock, pgsql_types]},
   {registered, []},