You can only contribute what is earned in a calendar year, up to the maximum Roth limit.
When DS started working during HS summers, we matched what he deposited in his Roth, 100% of what he earned, which was less than the limit. We stopped the match when he was able to get internships during college that paid more than the limit, but by then he still contributed the limit.