/Makefile (59088512ef8bc34f48552f9d24927d133249a64d) (3247 bytes) (mode 100644) (type blob)
CFLAGS ?= -O3 -flto -MMD
VERSION := $(shell git rev-parse --short HEAD)
# when testing and releasing, we can't run both in parallel
# but we also don't want to test when we're just making the zip
# additionaly we want to test before we make any zip file
# so these rules depend on test just when we're both releasing and testing
ifneq (,$(findstring release,$(MAKECMDGOALS)))
ifneq (,$(findstring test,$(MAKECMDGOALS)))
pjass-git-$(VERSION).zip: | test
pjass-git-$(VERSION)-src.zip: | test
endif
endif
SRC := misc.c hashtable.c paramlist.c funcdecl.c typeandname.c
OBJS := $(SRC:.c=.o)
OBJS += main.o token.yy.o grammar.tab.o
.PHONY: all release clean debug prof
.PHONY: clean-release-files clean-prof-files clean-build-files
.PHONY: binary-release src-release
.PHONY: help
all: pjass
help:
@awk -F ':|##' \
'/^[^\t].+?:.*?##/ { \
printf "\033[36m%-20s\033[0m %s\n", $$1, $$NF \
}' $(MAKEFILE_LIST)
-include $(OBJS:.o=.d)
pjass: $(OBJS) ## Builds pjass
$(CC) $(CFLAGS) $^ -o $@
test: should-fail should-check map-scripts ## Runs all tests
release: src-release binary-release ## Builds a pjass release with src- and bin-zipballs
clean: clean-build-files clean-release-files clean-prof-files ## Cleans the whole project
debug: CFLAGS = -w -g
debug: pjass ## Builds pjass with debugging support
prof: CFLAGS = -w -pg
prof: pjass ## Builds pjass with profiling support. You can run all tests with profiling enabled via `make PROF=1 test`
main.o: main.c
$(CC) $(CFLAGS) -c -o $@ $< -DVERSIONSTR="\"git-$(VERSION)\""
%.o: %.c %.h
$(CC) $(CFLAGS) -c -o $@ $<
token.yy.o: token.yy.c | grammar.tab.h
main.o: main.c | grammar.tab.h
# see token.l options block
%.yy.c %.yy.h: %.l
flex $<
%.tab.c %.tab.h: %.y
bison -d $<
clean-build-files: ## Cleans all build files
rm -f grammar.tab.h grammar.tab.c token.yy.c token.yy.h \
$(OBJS) $(OBJS:.o=.d) \
pjass
clean-release-files: ## Cleans all release zipballs
rm -f pjass-git-*.zip
clean-prof-files: ## Cleans all profiling files
rm -f tests/should-check/*-analysis.txt \
tests/should-fail/*-analysis.txt \
gmon.out
src-release: pjass-git-$(VERSION)-src.zip ## Builds the source zipball
binary-release: pjass-git-$(VERSION).zip ## Builds the exe zipball
pjass-git-$(VERSION)-src.zip: main.c grammar.y token.l Makefile notes.txt readme.txt $(SRC:.c=.h) $(SRC)
zip -q -r pjass-git-$(VERSION)-src.zip $^ tests/should-check/ tests/should-fail/
pjass-git-$(VERSION).zip: pjass
strip pjass
upx --best --ultra-brute pjass > /dev/null
zip -q pjass-git-$(VERSION).zip pjass
SHOULD_FAIL := $(wildcard tests/should-fail/*.j)
SHOULD_CHECK := $(wildcard tests/should-check/*.j)
MAP_SCRIPTS := $(wildcard tests/map-scripts/*.j)
.PHONY: test print-test should-check should-fail map-scripts
.PHONY: $(SHOULD_CHECK) $(SHOULD_FAIL) $(MAP_SCRIPTS)
$(MAP_SCRIPTS): pjass print-test
@MAPSCRIPT=1 ./check.sh $@
$(SHOULD_CHECK): pjass print-test
@./check.sh $@
$(SHOULD_FAIL): pjass print-test
@./fail.sh $@
should-fail: $(SHOULD_FAIL) ## Tests that should fail
should-check: $(SHOULD_CHECK) ## Tests that should check
map-scripts: $(MAP_SCRIPTS) ## Tests which are run with common.j and Blizzard.j
print-test: pjass
@echo 'Testing... '
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
168 |
c1ca22975fdbd25aedc5c81f51b87f059bbc4140 |
.gitignore |
100644 |
blob |
3247 |
59088512ef8bc34f48552f9d24927d133249a64d |
Makefile |
100755 |
blob |
391 |
1f49d20bfca22ddee132b62a37c103610d08e211 |
check.sh |
100755 |
blob |
219 |
debf6a860da565f1e9e8d5a8c8a58daba0757ac4 |
fail.sh |
100644 |
blob |
215 |
e2d0c0f230e4387accdf5037eca5ee512c90a8a0 |
funcdecl.c |
100644 |
blob |
236 |
99ca506caaa5e457089f7391b005351fe8a0f2de |
funcdecl.h |
100644 |
blob |
21154 |
eabaaffedf414977d5a47c920fbe40e96c1309cc |
grammar.y |
100644 |
blob |
2628 |
42cca350d155bcf65468482fb4c9a19c09e777e6 |
hashtable.c |
100644 |
blob |
501 |
2185dc1cb949f6fa3a1b0985b4caaf7769456156 |
hashtable.h |
100644 |
blob |
5111 |
c38e8afb91fd5788b7346f112ca9bb8cb0e73741 |
main.c |
100644 |
blob |
19916 |
eebdfbf50c72727c62250de658d1546308565640 |
misc.c |
100644 |
blob |
3401 |
817d16acb9d442c09a5a9d388d690a866b946f4c |
misc.h |
100644 |
blob |
1302 |
13d65e05aca85cddd2f539b14d98cfbf1c622752 |
notes.txt |
100644 |
blob |
330 |
92a4597d6df5097c58649391541d54f06b3bda1b |
paramlist.c |
100644 |
blob |
256 |
bb253362ef26a0ea881856aebeb8503fb82646fb |
paramlist.h |
100644 |
blob |
764 |
270df8583e78c80f366a8ab431fab673d89446d5 |
readme.txt |
040000 |
tree |
- |
8edb23b3ecd9a20c20e130f517ad5e4dee09ffea |
tests |
100644 |
blob |
6115 |
a4763c19dd0a9d8ba9435d0144b4d7b453603459 |
token.l |
100644 |
blob |
2124 |
711a9093cb566e29afcb86e1aad750532166738f |
typeandname.c |
100644 |
blob |
914 |
c7c2ecbf5459c7cb80bd2661e6ca78c32a780e10 |
typeandname.h |
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"
Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/vrtc/pjass
Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/vrtc/pjass
Clone this repository using git:
git clone git://git.rocketgit.com/user/vrtc/pjass
You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a
merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main